From fd601890f43b42776c3ed14d6a9f2bb050b8a392 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 8 May 2026 11:07:53 +0000 Subject: [PATCH 1/2] feat: Dart SDK update for version 23.1.0 --- CHANGELOG.md | 6 + README.md | 4 +- .../databases/create-big-int-attribute.md | 21 + .../databases/update-big-int-attribute.md | 21 + docs/examples/functions/create-variable.md | 1 + docs/examples/functions/create.md | 2 +- docs/examples/functions/list-variables.md | 2 + docs/examples/functions/update-variable.md | 2 +- docs/examples/functions/update.md | 2 +- docs/examples/presences/delete.md | 14 + docs/examples/presences/get.md | 14 + docs/examples/presences/list.md | 16 + docs/examples/presences/update-presence.md | 22 + docs/examples/presences/upsert.md | 21 + docs/examples/project/create-ephemeral-key.md | 16 + docs/examples/project/create-key.md | 2 +- docs/examples/project/create-mock-phone.md | 15 + docs/examples/project/create-smtp-test.md | 14 + docs/examples/project/delete-mock-phone.md | 14 + docs/examples/project/delete.md | 12 + docs/examples/project/get-email-template.md | 16 + docs/examples/project/get-mock-phone.md | 14 + .../examples/project/get-o-auth-2-provider.md | 15 + docs/examples/project/get-policy.md | 15 + docs/examples/project/list-email-templates.md | 15 + docs/examples/project/list-mock-phones.md | 15 + .../project/list-o-auth-2-providers.md | 15 + docs/examples/project/list-policies.md | 15 + docs/examples/project/update-auth-method.md | 16 + .../examples/project/update-email-template.md | 22 + docs/examples/project/update-key.md | 2 +- .../update-membership-privacy-policy.md | 18 + docs/examples/project/update-mock-phone.md | 15 + .../project/update-o-auth-2-amazon.md | 16 + .../examples/project/update-o-auth-2-apple.md | 18 + .../project/update-o-auth-2-auth-0.md | 17 + .../project/update-o-auth-2-authentik.md | 17 + .../project/update-o-auth-2-autodesk.md | 16 + .../project/update-o-auth-2-bitbucket.md | 16 + .../examples/project/update-o-auth-2-bitly.md | 16 + docs/examples/project/update-o-auth-2-box.md | 16 + .../project/update-o-auth-2-dailymotion.md | 16 + .../project/update-o-auth-2-discord.md | 16 + .../project/update-o-auth-2-disqus.md | 16 + .../project/update-o-auth-2-dropbox.md | 16 + docs/examples/project/update-o-auth-2-etsy.md | 16 + .../project/update-o-auth-2-facebook.md | 16 + .../examples/project/update-o-auth-2-figma.md | 16 + .../project/update-o-auth-2-fusion-auth.md | 17 + .../project/update-o-auth-2-git-hub.md | 16 + .../project/update-o-auth-2-gitlab.md | 17 + .../project/update-o-auth-2-google.md | 16 + .../project/update-o-auth-2-keycloak.md | 18 + docs/examples/project/update-o-auth-2-kick.md | 16 + .../project/update-o-auth-2-linkedin.md | 16 + .../project/update-o-auth-2-microsoft.md | 17 + .../project/update-o-auth-2-notion.md | 16 + docs/examples/project/update-o-auth-2-oidc.md | 20 + docs/examples/project/update-o-auth-2-okta.md | 18 + .../project/update-o-auth-2-paypal-sandbox.md | 16 + .../project/update-o-auth-2-paypal.md | 16 + .../examples/project/update-o-auth-2-podio.md | 16 + .../project/update-o-auth-2-salesforce.md | 16 + .../examples/project/update-o-auth-2-slack.md | 16 + .../project/update-o-auth-2-spotify.md | 16 + .../project/update-o-auth-2-stripe.md | 16 + .../update-o-auth-2-tradeshift-sandbox.md | 16 + .../project/update-o-auth-2-tradeshift.md | 16 + .../project/update-o-auth-2-twitch.md | 16 + .../project/update-o-auth-2-word-press.md | 16 + .../examples/project/update-o-auth-2-yahoo.md | 16 + .../project/update-o-auth-2-yandex.md | 16 + docs/examples/project/update-o-auth-2-zoho.md | 16 + docs/examples/project/update-o-auth-2-zoom.md | 16 + docs/examples/project/update-o-auth-2x.md | 16 + .../update-password-dictionary-policy.md | 14 + .../project/update-password-history-policy.md | 14 + .../update-password-personal-data-policy.md | 14 + ...-protocol-status.md => update-protocol.md} | 2 +- ...te-service-status.md => update-service.md} | 2 +- .../project/update-session-alert-policy.md | 14 + .../project/update-session-duration-policy.md | 14 + .../update-session-invalidation-policy.md | 14 + .../project/update-session-limit-policy.md | 14 + docs/examples/project/update-smtp.md | 24 + .../project/update-user-limit-policy.md | 14 + docs/examples/proxy/create-api-rule.md | 14 + docs/examples/proxy/create-function-rule.md | 16 + docs/examples/proxy/create-redirect-rule.md | 19 + docs/examples/proxy/create-site-rule.md | 16 + docs/examples/proxy/delete-rule.md | 14 + docs/examples/proxy/get-rule.md | 14 + docs/examples/proxy/list-rules.md | 15 + docs/examples/proxy/update-rule-status.md | 14 + docs/examples/sites/create-variable.md | 1 + docs/examples/sites/list-variables.md | 2 + docs/examples/sites/update-variable.md | 2 +- .../tablesdb/create-big-int-column.md | 21 + .../tablesdb/update-big-int-column.md | 21 + lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/dart_appwrite.dart | 2 + lib/enums.dart | 10 + lib/models.dart | 61 + lib/operator.dart | 11 +- lib/query.dart | 91 +- lib/role.dart | 2 +- lib/services/account.dart | 987 +++-- lib/services/activities.dart | 40 +- lib/services/avatars.dart | 224 +- lib/services/backups.dart | 243 +- lib/services/databases.dart | 2088 ++++----- lib/services/functions.dart | 676 ++- lib/services/graphql.dart | 36 +- lib/services/health.dart | 428 +- lib/services/locale.dart | 160 +- lib/services/messaging.dart | 1744 ++++---- lib/services/presences.dart | 117 + lib/services/project.dart | 2479 +++++++++-- lib/services/proxy.dart | 196 + lib/services/sites.dart | 638 ++- lib/services/storage.dart | 342 +- lib/services/tables_db.dart | 1908 ++++---- lib/services/teams.dart | 283 +- lib/services/tokens.dart | 93 +- lib/services/users.dart | 993 +++-- lib/services/webhooks.dart | 148 +- lib/src/client.dart | 18 +- lib/src/client_base.dart | 15 +- lib/src/client_browser.dart | 159 +- lib/src/client_io.dart | 159 +- lib/src/client_mixin.dart | 35 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/attribute_status.dart | 20 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/backup_services.dart | 22 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/browser_permission.dart | 50 +- lib/src/enums/build_runtime.dart | 187 +- lib/src/enums/column_status.dart | 20 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/database_type.dart | 18 +- lib/src/enums/databases_index_type.dart | 18 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/deployment_status.dart | 22 +- lib/src/enums/email_template_locale.dart | 143 + lib/src/enums/email_template_type.dart | 19 + lib/src/enums/execution_method.dart | 24 +- lib/src/enums/execution_status.dart | 20 +- lib/src/enums/execution_trigger.dart | 16 +- lib/src/enums/flag.dart | 400 +- lib/src/enums/framework.dart | 40 +- lib/src/enums/health_antivirus_status.dart | 16 +- lib/src/enums/health_check_status.dart | 14 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_status.dart | 20 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/message_status.dart | 20 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/method_id.dart | 19 + lib/src/enums/name.dart | 36 +- lib/src/enums/o_auth_provider.dart | 93 +- lib/src/enums/order_by.dart | 14 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/platform_type.dart | 20 +- lib/src/enums/policy_id.dart | 21 + lib/src/enums/protocol_id.dart | 16 +- lib/src/enums/provider_id.dart | 59 + lib/src/enums/proxy_resource_type.dart | 14 + .../proxy_rule_deployment_resource_type.dart | 14 + lib/src/enums/proxy_rule_status.dart | 15 + lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 187 +- lib/src/enums/scopes.dart | 173 +- lib/src/enums/secure.dart | 14 + lib/src/enums/service_id.dart | 44 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/status_code.dart | 16 + lib/src/enums/tables_db_index_type.dart | 18 +- lib/src/enums/template_reference_type.dart | 16 +- lib/src/enums/theme.dart | 14 +- lib/src/enums/timezone.dart | 848 ++-- lib/src/enums/vcs_reference_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/activity_event.dart | 388 +- lib/src/models/activity_event_list.dart | 43 +- lib/src/models/algo_argon2.dart | 62 +- lib/src/models/algo_bcrypt.dart | 32 +- lib/src/models/algo_md5.dart | 32 +- lib/src/models/algo_phpass.dart | 32 +- lib/src/models/algo_scrypt.dart | 86 +- lib/src/models/algo_scrypt_modified.dart | 62 +- lib/src/models/algo_sha.dart | 32 +- lib/src/models/attribute_bigint.dart | 84 + lib/src/models/attribute_boolean.dart | 113 +- lib/src/models/attribute_datetime.dart | 123 +- lib/src/models/attribute_email.dart | 123 +- lib/src/models/attribute_enum.dart | 133 +- lib/src/models/attribute_float.dart | 133 +- lib/src/models/attribute_integer.dart | 133 +- lib/src/models/attribute_ip.dart | 123 +- lib/src/models/attribute_line.dart | 113 +- lib/src/models/attribute_list.dart | 42 +- lib/src/models/attribute_longtext.dart | 123 +- lib/src/models/attribute_mediumtext.dart | 123 +- lib/src/models/attribute_point.dart | 113 +- lib/src/models/attribute_polygon.dart | 113 +- lib/src/models/attribute_relationship.dart | 195 +- lib/src/models/attribute_string.dart | 133 +- lib/src/models/attribute_text.dart | 123 +- lib/src/models/attribute_url.dart | 123 +- lib/src/models/attribute_varchar.dart | 133 +- lib/src/models/auth_provider.dart | 86 +- lib/src/models/backup_archive.dart | 142 +- lib/src/models/backup_archive_list.dart | 43 +- lib/src/models/backup_policy.dart | 132 +- lib/src/models/backup_policy_list.dart | 43 +- lib/src/models/backup_restoration.dart | 132 +- lib/src/models/backup_restoration_list.dart | 43 +- lib/src/models/billing_limits.dart | 102 +- lib/src/models/block.dart | 116 +- lib/src/models/bucket.dart | 194 +- lib/src/models/bucket_list.dart | 42 +- lib/src/models/collection.dart | 142 +- lib/src/models/collection_list.dart | 43 +- lib/src/models/column_bigint.dart | 84 + lib/src/models/column_boolean.dart | 113 +- lib/src/models/column_datetime.dart | 123 +- lib/src/models/column_email.dart | 123 +- lib/src/models/column_enum.dart | 133 +- lib/src/models/column_float.dart | 133 +- lib/src/models/column_index.dart | 122 +- lib/src/models/column_index_list.dart | 43 +- lib/src/models/column_integer.dart | 133 +- lib/src/models/column_ip.dart | 123 +- lib/src/models/column_line.dart | 113 +- lib/src/models/column_list.dart | 42 +- lib/src/models/column_longtext.dart | 123 +- lib/src/models/column_mediumtext.dart | 123 +- lib/src/models/column_point.dart | 113 +- lib/src/models/column_polygon.dart | 113 +- lib/src/models/column_relationship.dart | 195 +- lib/src/models/column_string.dart | 133 +- lib/src/models/column_text.dart | 123 +- lib/src/models/column_url.dart | 123 +- lib/src/models/column_varchar.dart | 133 +- lib/src/models/continent.dart | 42 +- lib/src/models/continent_list.dart | 43 +- lib/src/models/country.dart | 42 +- lib/src/models/country_list.dart | 43 +- lib/src/models/currency.dart | 110 +- lib/src/models/currency_list.dart | 43 +- lib/src/models/database.dart | 103 +- lib/src/models/database_list.dart | 43 +- lib/src/models/deployment.dart | 341 +- lib/src/models/deployment_list.dart | 43 +- lib/src/models/dev_key.dart | 102 +- lib/src/models/document.dart | 102 +- lib/src/models/document_list.dart | 47 +- lib/src/models/email_template.dart | 66 + lib/src/models/email_template_list.dart | 30 + lib/src/models/ephemeral_key.dart | 72 + lib/src/models/execution.dart | 246 +- lib/src/models/execution_list.dart | 43 +- lib/src/models/file.dart | 182 +- lib/src/models/file_list.dart | 42 +- lib/src/models/framework.dart | 87 +- lib/src/models/framework_adapter.dart | 86 +- lib/src/models/framework_list.dart | 43 +- lib/src/models/function.dart | 368 +- lib/src/models/function_list.dart | 42 +- lib/src/models/headers.dart | 42 +- lib/src/models/health_antivirus.dart | 43 +- lib/src/models/health_certificate.dart | 98 +- lib/src/models/health_queue.dart | 32 +- lib/src/models/health_status.dart | 53 +- lib/src/models/health_status_list.dart | 43 +- lib/src/models/health_time.dart | 52 +- lib/src/models/identity.dart | 122 +- lib/src/models/identity_list.dart | 43 +- lib/src/models/index.dart | 123 +- lib/src/models/index_list.dart | 42 +- lib/src/models/jwt.dart | 32 +- lib/src/models/key.dart | 112 +- lib/src/models/key_list.dart | 42 +- lib/src/models/language.dart | 52 +- lib/src/models/language_list.dart | 43 +- lib/src/models/locale.dart | 110 +- lib/src/models/locale_code.dart | 42 +- lib/src/models/locale_code_list.dart | 43 +- lib/src/models/log.dart | 290 +- lib/src/models/log_list.dart | 42 +- lib/src/models/membership.dart | 188 +- lib/src/models/membership_list.dart | 43 +- lib/src/models/message.dart | 183 +- lib/src/models/message_list.dart | 43 +- lib/src/models/mfa_challenge.dart | 62 +- lib/src/models/mfa_factors.dart | 62 +- lib/src/models/mfa_recovery_codes.dart | 32 +- lib/src/models/mfa_type.dart | 42 +- lib/src/models/mock_number.dart | 54 +- lib/src/models/mock_number_list.dart | 30 + lib/src/models/model.dart | 2 +- lib/src/models/o_auth2_amazon.dart | 42 + lib/src/models/o_auth2_apple.dart | 54 + lib/src/models/o_auth2_auth0.dart | 48 + lib/src/models/o_auth2_authentik.dart | 48 + lib/src/models/o_auth2_autodesk.dart | 42 + lib/src/models/o_auth2_bitbucket.dart | 42 + lib/src/models/o_auth2_bitly.dart | 42 + lib/src/models/o_auth2_box.dart | 42 + lib/src/models/o_auth2_dailymotion.dart | 42 + lib/src/models/o_auth2_discord.dart | 42 + lib/src/models/o_auth2_disqus.dart | 42 + lib/src/models/o_auth2_dropbox.dart | 42 + lib/src/models/o_auth2_etsy.dart | 42 + lib/src/models/o_auth2_facebook.dart | 42 + lib/src/models/o_auth2_figma.dart | 42 + lib/src/models/o_auth2_fusion_auth.dart | 48 + lib/src/models/o_auth2_github.dart | 42 + lib/src/models/o_auth2_gitlab.dart | 48 + lib/src/models/o_auth2_google.dart | 42 + lib/src/models/o_auth2_keycloak.dart | 54 + lib/src/models/o_auth2_kick.dart | 42 + lib/src/models/o_auth2_linkedin.dart | 42 + lib/src/models/o_auth2_microsoft.dart | 48 + lib/src/models/o_auth2_notion.dart | 42 + lib/src/models/o_auth2_oidc.dart | 66 + lib/src/models/o_auth2_okta.dart | 54 + lib/src/models/o_auth2_paypal.dart | 42 + lib/src/models/o_auth2_podio.dart | 42 + lib/src/models/o_auth2_provider_list.dart | 30 + lib/src/models/o_auth2_salesforce.dart | 42 + lib/src/models/o_auth2_slack.dart | 42 + lib/src/models/o_auth2_spotify.dart | 42 + lib/src/models/o_auth2_stripe.dart | 42 + lib/src/models/o_auth2_tradeshift.dart | 42 + lib/src/models/o_auth2_twitch.dart | 42 + lib/src/models/o_auth2_word_press.dart | 42 + lib/src/models/o_auth2_x.dart | 42 + lib/src/models/o_auth2_yahoo.dart | 42 + lib/src/models/o_auth2_yandex.dart | 42 + lib/src/models/o_auth2_zoho.dart | 42 + lib/src/models/o_auth2_zoom.dart | 42 + lib/src/models/phone.dart | 52 +- lib/src/models/phone_list.dart | 42 +- lib/src/models/platform_android.dart | 98 +- lib/src/models/platform_apple.dart | 98 +- lib/src/models/platform_linux.dart | 98 +- lib/src/models/platform_list.dart | 42 +- lib/src/models/platform_web.dart | 98 +- lib/src/models/platform_windows.dart | 98 +- lib/src/models/policy_list.dart | 30 + lib/src/models/policy_membership_privacy.dart | 54 + .../models/policy_password_dictionary.dart | 30 + lib/src/models/policy_password_history.dart | 30 + .../models/policy_password_personal_data.dart | 30 + lib/src/models/policy_session_alert.dart | 30 + lib/src/models/policy_session_duration.dart | 30 + .../models/policy_session_invalidation.dart | 30 + lib/src/models/policy_session_limit.dart | 30 + lib/src/models/policy_user_limit.dart | 30 + lib/src/models/preferences.dart | 32 +- lib/src/models/presence.dart | 85 + lib/src/models/presence_list.dart | 33 + lib/src/models/project.dart | 859 ++-- lib/src/models/provider.dart | 112 +- lib/src/models/provider_list.dart | 43 +- lib/src/models/proxy_rule.dart | 108 + lib/src/models/proxy_rule_list.dart | 30 + lib/src/models/resource_token.dart | 110 +- lib/src/models/resource_token_list.dart | 43 +- lib/src/models/row.dart | 102 +- lib/src/models/row_list.dart | 46 +- lib/src/models/runtime.dart | 102 +- lib/src/models/runtime_list.dart | 43 +- lib/src/models/session.dart | 360 +- lib/src/models/session_list.dart | 43 +- lib/src/models/site.dart | 388 +- lib/src/models/site_list.dart | 42 +- lib/src/models/specification.dart | 62 +- lib/src/models/specification_list.dart | 43 +- lib/src/models/subscriber.dart | 112 +- lib/src/models/subscriber_list.dart | 43 +- lib/src/models/table.dart | 143 +- lib/src/models/table_list.dart | 42 +- lib/src/models/target.dart | 112 +- lib/src/models/target_list.dart | 42 +- lib/src/models/team.dart | 98 +- lib/src/models/team_list.dart | 42 +- lib/src/models/token.dart | 98 +- lib/src/models/topic.dart | 102 +- lib/src/models/topic_list.dart | 42 +- lib/src/models/transaction.dart | 98 +- lib/src/models/transaction_list.dart | 43 +- lib/src/models/user.dart | 278 +- lib/src/models/user_list.dart | 42 +- lib/src/models/variable.dart | 102 +- lib/src/models/variable_list.dart | 43 +- lib/src/models/webhook.dart | 182 +- lib/src/models/webhook_list.dart | 43 +- pubspec.yaml | 2 +- test/query_test.dart | 1 + test/services/account_test.dart | 2546 ++++++----- test/services/activities_test.dart | 143 +- test/services/avatars_test.dart | 188 +- test/services/backups_test.dart | 490 ++- test/services/databases_test.dart | 3204 +++++++------- test/services/functions_test.dart | 1482 ++++--- test/services/graphql_test.dart | 63 +- test/services/health_test.dart | 644 +-- test/services/locale_test.dart | 245 +- test/services/messaging_test.dart | 2416 +++++----- test/services/presences_test.dart | 164 + test/services/project_test.dart | 3893 +++++++++++++---- test/services/proxy_test.dart | 278 ++ test/services/sites_test.dart | 1437 +++--- test/services/storage_test.dart | 545 +-- test/services/tables_db_test.dart | 3204 +++++++------- test/services/teams_test.dart | 535 +-- test/services/tokens_test.dart | 212 +- test/services/users_test.dart | 2212 +++++----- test/services/webhooks_test.dart | 301 +- test/src/models/activity_event_list_test.dart | 6 +- test/src/models/activity_event_test.dart | 70 +- test/src/models/algo_argon2_test.dart | 10 +- test/src/models/algo_bcrypt_test.dart | 4 +- test/src/models/algo_md5_test.dart | 4 +- test/src/models/algo_phpass_test.dart | 4 +- .../src/models/algo_scrypt_modified_test.dart | 14 +- test/src/models/algo_scrypt_test.dart | 12 +- test/src/models/algo_sha_test.dart | 4 +- test/src/models/attribute_bigint_test.dart | 30 + test/src/models/attribute_boolean_test.dart | 16 +- test/src/models/attribute_datetime_test.dart | 18 +- test/src/models/attribute_email_test.dart | 18 +- test/src/models/attribute_enum_test.dart | 20 +- test/src/models/attribute_float_test.dart | 16 +- test/src/models/attribute_integer_test.dart | 16 +- test/src/models/attribute_ip_test.dart | 18 +- test/src/models/attribute_line_test.dart | 16 +- test/src/models/attribute_list_test.dart | 6 +- test/src/models/attribute_longtext_test.dart | 16 +- .../src/models/attribute_mediumtext_test.dart | 16 +- test/src/models/attribute_point_test.dart | 16 +- test/src/models/attribute_polygon_test.dart | 16 +- .../models/attribute_relationship_test.dart | 28 +- test/src/models/attribute_string_test.dart | 18 +- test/src/models/attribute_text_test.dart | 16 +- test/src/models/attribute_url_test.dart | 18 +- test/src/models/attribute_varchar_test.dart | 18 +- test/src/models/auth_provider_test.dart | 14 +- test/src/models/backup_archive_list_test.dart | 6 +- test/src/models/backup_archive_test.dart | 22 +- test/src/models/backup_policy_list_test.dart | 6 +- test/src/models/backup_policy_test.dart | 20 +- .../models/backup_restoration_list_test.dart | 6 +- test/src/models/backup_restoration_test.dart | 24 +- test/src/models/billing_limits_test.dart | 18 +- test/src/models/block_test.dart | 18 +- test/src/models/bucket_list_test.dart | 6 +- test/src/models/bucket_test.dart | 30 +- test/src/models/collection_list_test.dart | 6 +- test/src/models/collection_test.dart | 26 +- test/src/models/column_bigint_test.dart | 30 + test/src/models/column_boolean_test.dart | 16 +- test/src/models/column_datetime_test.dart | 18 +- test/src/models/column_email_test.dart | 18 +- test/src/models/column_enum_test.dart | 20 +- test/src/models/column_float_test.dart | 16 +- test/src/models/column_index_list_test.dart | 6 +- test/src/models/column_index_test.dart | 20 +- test/src/models/column_integer_test.dart | 16 +- test/src/models/column_ip_test.dart | 18 +- test/src/models/column_line_test.dart | 16 +- test/src/models/column_list_test.dart | 6 +- test/src/models/column_longtext_test.dart | 16 +- test/src/models/column_mediumtext_test.dart | 16 +- test/src/models/column_point_test.dart | 16 +- test/src/models/column_polygon_test.dart | 16 +- test/src/models/column_relationship_test.dart | 28 +- test/src/models/column_string_test.dart | 18 +- test/src/models/column_text_test.dart | 16 +- test/src/models/column_url_test.dart | 18 +- test/src/models/column_varchar_test.dart | 18 +- test/src/models/continent_list_test.dart | 6 +- test/src/models/continent_test.dart | 6 +- test/src/models/country_list_test.dart | 6 +- test/src/models/country_test.dart | 6 +- test/src/models/currency_list_test.dart | 6 +- test/src/models/currency_test.dart | 16 +- test/src/models/database_list_test.dart | 6 +- test/src/models/database_test.dart | 18 +- test/src/models/deployment_list_test.dart | 6 +- test/src/models/deployment_test.dart | 69 +- test/src/models/dev_key_test.dart | 18 +- test/src/models/document_list_test.dart | 6 +- test/src/models/document_test.dart | 16 +- test/src/models/email_template_list_test.dart | 19 + test/src/models/email_template_test.dart | 31 + test/src/models/ephemeral_key_test.dart | 33 + test/src/models/execution_list_test.dart | 6 +- test/src/models/execution_test.dart | 36 +- test/src/models/file_list_test.dart | 6 +- test/src/models/file_test.dart | 28 +- test/src/models/framework_adapter_test.dart | 12 +- test/src/models/framework_list_test.dart | 6 +- test/src/models/framework_test.dart | 12 +- test/src/models/function_list_test.dart | 6 +- test/src/models/function_test.dart | 62 +- test/src/models/headers_test.dart | 6 +- test/src/models/health_antivirus_test.dart | 6 +- test/src/models/health_certificate_test.dart | 14 +- test/src/models/health_queue_test.dart | 4 +- test/src/models/health_status_list_test.dart | 6 +- test/src/models/health_status_test.dart | 8 +- test/src/models/health_time_test.dart | 8 +- test/src/models/identity_list_test.dart | 6 +- test/src/models/identity_test.dart | 22 +- test/src/models/index_list_test.dart | 6 +- test/src/models/index_test.dart | 20 +- test/src/models/jwt_test.dart | 8 +- test/src/models/key_list_test.dart | 6 +- test/src/models/key_test.dart | 20 +- test/src/models/language_list_test.dart | 6 +- test/src/models/language_test.dart | 8 +- test/src/models/locale_code_list_test.dart | 6 +- test/src/models/locale_code_test.dart | 6 +- test/src/models/locale_test.dart | 16 +- test/src/models/log_list_test.dart | 6 +- test/src/models/log_test.dart | 46 +- test/src/models/membership_list_test.dart | 6 +- test/src/models/membership_test.dart | 30 +- test/src/models/message_list_test.dart | 6 +- test/src/models/message_test.dart | 22 +- test/src/models/mfa_challenge_test.dart | 10 +- test/src/models/mfa_factors_test.dart | 10 +- test/src/models/mfa_recovery_codes_test.dart | 4 +- test/src/models/mfa_type_test.dart | 10 +- test/src/models/mock_number_list_test.dart | 19 + test/src/models/mock_number_test.dart | 12 +- test/src/models/o_auth2_amazon_test.dart | 23 + test/src/models/o_auth2_apple_test.dart | 27 + test/src/models/o_auth2_auth0_test.dart | 25 + test/src/models/o_auth2_authentik_test.dart | 25 + test/src/models/o_auth2_autodesk_test.dart | 23 + test/src/models/o_auth2_bitbucket_test.dart | 23 + test/src/models/o_auth2_bitly_test.dart | 23 + test/src/models/o_auth2_box_test.dart | 23 + test/src/models/o_auth2_dailymotion_test.dart | 23 + test/src/models/o_auth2_discord_test.dart | 23 + test/src/models/o_auth2_disqus_test.dart | 23 + test/src/models/o_auth2_dropbox_test.dart | 23 + test/src/models/o_auth2_etsy_test.dart | 23 + test/src/models/o_auth2_facebook_test.dart | 23 + test/src/models/o_auth2_figma_test.dart | 23 + test/src/models/o_auth2_fusion_auth_test.dart | 25 + test/src/models/o_auth2_github_test.dart | 23 + test/src/models/o_auth2_gitlab_test.dart | 25 + test/src/models/o_auth2_google_test.dart | 23 + test/src/models/o_auth2_keycloak_test.dart | 27 + test/src/models/o_auth2_kick_test.dart | 23 + test/src/models/o_auth2_linkedin_test.dart | 23 + test/src/models/o_auth2_microsoft_test.dart | 25 + test/src/models/o_auth2_notion_test.dart | 23 + test/src/models/o_auth2_oidc_test.dart | 31 + test/src/models/o_auth2_okta_test.dart | 27 + test/src/models/o_auth2_paypal_test.dart | 23 + test/src/models/o_auth2_podio_test.dart | 23 + .../models/o_auth2_provider_list_test.dart | 19 + test/src/models/o_auth2_salesforce_test.dart | 23 + test/src/models/o_auth2_slack_test.dart | 23 + test/src/models/o_auth2_spotify_test.dart | 23 + test/src/models/o_auth2_stripe_test.dart | 23 + test/src/models/o_auth2_tradeshift_test.dart | 23 + test/src/models/o_auth2_twitch_test.dart | 23 + test/src/models/o_auth2_word_press_test.dart | 23 + test/src/models/o_auth2_x_test.dart | 23 + test/src/models/o_auth2_yahoo_test.dart | 23 + test/src/models/o_auth2_yandex_test.dart | 23 + test/src/models/o_auth2_zoho_test.dart | 23 + test/src/models/o_auth2_zoom_test.dart | 23 + test/src/models/phone_list_test.dart | 6 +- test/src/models/phone_test.dart | 8 +- test/src/models/platform_android_test.dart | 14 +- test/src/models/platform_apple_test.dart | 14 +- test/src/models/platform_linux_test.dart | 14 +- test/src/models/platform_list_test.dart | 6 +- test/src/models/platform_web_test.dart | 14 +- test/src/models/platform_windows_test.dart | 14 +- test/src/models/policy_list_test.dart | 19 + .../policy_membership_privacy_test.dart | 27 + .../policy_password_dictionary_test.dart | 19 + .../models/policy_password_history_test.dart | 19 + .../policy_password_personal_data_test.dart | 19 + .../src/models/policy_session_alert_test.dart | 19 + .../models/policy_session_duration_test.dart | 19 + .../policy_session_invalidation_test.dart | 19 + .../src/models/policy_session_limit_test.dart | 19 + test/src/models/policy_user_limit_test.dart | 19 + test/src/models/preferences_test.dart | 1 + test/src/models/presence_list_test.dart | 19 + test/src/models/presence_test.dart | 32 + test/src/models/project_test.dart | 184 +- test/src/models/provider_list_test.dart | 6 +- test/src/models/provider_test.dart | 18 +- test/src/models/proxy_rule_list_test.dart | 19 + test/src/models/proxy_rule_test.dart | 44 + test/src/models/resource_token_list_test.dart | 6 +- test/src/models/resource_token_test.dart | 20 +- test/src/models/row_list_test.dart | 6 +- test/src/models/row_test.dart | 16 +- test/src/models/runtime_list_test.dart | 6 +- test/src/models/runtime_test.dart | 18 +- test/src/models/session_list_test.dart | 6 +- test/src/models/session_test.dart | 60 +- test/src/models/site_list_test.dart | 6 +- test/src/models/site_test.dart | 66 +- test/src/models/specification_list_test.dart | 6 +- test/src/models/specification_test.dart | 10 +- test/src/models/subscriber_list_test.dart | 6 +- test/src/models/subscriber_test.dart | 36 +- test/src/models/table_list_test.dart | 6 +- test/src/models/table_test.dart | 26 +- test/src/models/target_list_test.dart | 6 +- test/src/models/target_test.dart | 18 +- test/src/models/team_list_test.dart | 6 +- test/src/models/team_test.dart | 12 +- test/src/models/token_test.dart | 14 +- test/src/models/topic_list_test.dart | 6 +- test/src/models/topic_test.dart | 18 +- test/src/models/transaction_list_test.dart | 6 +- test/src/models/transaction_test.dart | 14 +- test/src/models/user_list_test.dart | 6 +- test/src/models/user_test.dart | 32 +- test/src/models/variable_list_test.dart | 6 +- test/src/models/variable_test.dart | 18 +- test/src/models/webhook_list_test.dart | 6 +- test/src/models/webhook_test.dart | 28 +- 643 files changed, 38740 insertions(+), 26840 deletions(-) create mode 100644 docs/examples/databases/create-big-int-attribute.md create mode 100644 docs/examples/databases/update-big-int-attribute.md create mode 100644 docs/examples/presences/delete.md create mode 100644 docs/examples/presences/get.md create mode 100644 docs/examples/presences/list.md create mode 100644 docs/examples/presences/update-presence.md create mode 100644 docs/examples/presences/upsert.md create mode 100644 docs/examples/project/create-ephemeral-key.md create mode 100644 docs/examples/project/create-mock-phone.md create mode 100644 docs/examples/project/create-smtp-test.md create mode 100644 docs/examples/project/delete-mock-phone.md create mode 100644 docs/examples/project/delete.md create mode 100644 docs/examples/project/get-email-template.md create mode 100644 docs/examples/project/get-mock-phone.md create mode 100644 docs/examples/project/get-o-auth-2-provider.md create mode 100644 docs/examples/project/get-policy.md create mode 100644 docs/examples/project/list-email-templates.md create mode 100644 docs/examples/project/list-mock-phones.md create mode 100644 docs/examples/project/list-o-auth-2-providers.md create mode 100644 docs/examples/project/list-policies.md create mode 100644 docs/examples/project/update-auth-method.md create mode 100644 docs/examples/project/update-email-template.md create mode 100644 docs/examples/project/update-membership-privacy-policy.md create mode 100644 docs/examples/project/update-mock-phone.md create mode 100644 docs/examples/project/update-o-auth-2-amazon.md create mode 100644 docs/examples/project/update-o-auth-2-apple.md create mode 100644 docs/examples/project/update-o-auth-2-auth-0.md create mode 100644 docs/examples/project/update-o-auth-2-authentik.md create mode 100644 docs/examples/project/update-o-auth-2-autodesk.md create mode 100644 docs/examples/project/update-o-auth-2-bitbucket.md create mode 100644 docs/examples/project/update-o-auth-2-bitly.md create mode 100644 docs/examples/project/update-o-auth-2-box.md create mode 100644 docs/examples/project/update-o-auth-2-dailymotion.md create mode 100644 docs/examples/project/update-o-auth-2-discord.md create mode 100644 docs/examples/project/update-o-auth-2-disqus.md create mode 100644 docs/examples/project/update-o-auth-2-dropbox.md create mode 100644 docs/examples/project/update-o-auth-2-etsy.md create mode 100644 docs/examples/project/update-o-auth-2-facebook.md create mode 100644 docs/examples/project/update-o-auth-2-figma.md create mode 100644 docs/examples/project/update-o-auth-2-fusion-auth.md create mode 100644 docs/examples/project/update-o-auth-2-git-hub.md create mode 100644 docs/examples/project/update-o-auth-2-gitlab.md create mode 100644 docs/examples/project/update-o-auth-2-google.md create mode 100644 docs/examples/project/update-o-auth-2-keycloak.md create mode 100644 docs/examples/project/update-o-auth-2-kick.md create mode 100644 docs/examples/project/update-o-auth-2-linkedin.md create mode 100644 docs/examples/project/update-o-auth-2-microsoft.md create mode 100644 docs/examples/project/update-o-auth-2-notion.md create mode 100644 docs/examples/project/update-o-auth-2-oidc.md create mode 100644 docs/examples/project/update-o-auth-2-okta.md create mode 100644 docs/examples/project/update-o-auth-2-paypal-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-paypal.md create mode 100644 docs/examples/project/update-o-auth-2-podio.md create mode 100644 docs/examples/project/update-o-auth-2-salesforce.md create mode 100644 docs/examples/project/update-o-auth-2-slack.md create mode 100644 docs/examples/project/update-o-auth-2-spotify.md create mode 100644 docs/examples/project/update-o-auth-2-stripe.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift.md create mode 100644 docs/examples/project/update-o-auth-2-twitch.md create mode 100644 docs/examples/project/update-o-auth-2-word-press.md create mode 100644 docs/examples/project/update-o-auth-2-yahoo.md create mode 100644 docs/examples/project/update-o-auth-2-yandex.md create mode 100644 docs/examples/project/update-o-auth-2-zoho.md create mode 100644 docs/examples/project/update-o-auth-2-zoom.md create mode 100644 docs/examples/project/update-o-auth-2x.md create mode 100644 docs/examples/project/update-password-dictionary-policy.md create mode 100644 docs/examples/project/update-password-history-policy.md create mode 100644 docs/examples/project/update-password-personal-data-policy.md rename docs/examples/project/{update-protocol-status.md => update-protocol.md} (89%) rename docs/examples/project/{update-service-status.md => update-service.md} (89%) create mode 100644 docs/examples/project/update-session-alert-policy.md create mode 100644 docs/examples/project/update-session-duration-policy.md create mode 100644 docs/examples/project/update-session-invalidation-policy.md create mode 100644 docs/examples/project/update-session-limit-policy.md create mode 100644 docs/examples/project/update-smtp.md create mode 100644 docs/examples/project/update-user-limit-policy.md create mode 100644 docs/examples/proxy/create-api-rule.md create mode 100644 docs/examples/proxy/create-function-rule.md create mode 100644 docs/examples/proxy/create-redirect-rule.md create mode 100644 docs/examples/proxy/create-site-rule.md create mode 100644 docs/examples/proxy/delete-rule.md create mode 100644 docs/examples/proxy/get-rule.md create mode 100644 docs/examples/proxy/list-rules.md create mode 100644 docs/examples/proxy/update-rule-status.md create mode 100644 docs/examples/tablesdb/create-big-int-column.md create mode 100644 docs/examples/tablesdb/update-big-int-column.md create mode 100644 lib/services/presences.dart create mode 100644 lib/services/proxy.dart create mode 100644 lib/src/enums/email_template_locale.dart create mode 100644 lib/src/enums/email_template_type.dart create mode 100644 lib/src/enums/method_id.dart create mode 100644 lib/src/enums/policy_id.dart create mode 100644 lib/src/enums/provider_id.dart create mode 100644 lib/src/enums/proxy_resource_type.dart create mode 100644 lib/src/enums/proxy_rule_deployment_resource_type.dart create mode 100644 lib/src/enums/proxy_rule_status.dart create mode 100644 lib/src/enums/secure.dart create mode 100644 lib/src/enums/status_code.dart create mode 100644 lib/src/models/attribute_bigint.dart create mode 100644 lib/src/models/column_bigint.dart create mode 100644 lib/src/models/email_template.dart create mode 100644 lib/src/models/email_template_list.dart create mode 100644 lib/src/models/ephemeral_key.dart create mode 100644 lib/src/models/mock_number_list.dart create mode 100644 lib/src/models/o_auth2_amazon.dart create mode 100644 lib/src/models/o_auth2_apple.dart create mode 100644 lib/src/models/o_auth2_auth0.dart create mode 100644 lib/src/models/o_auth2_authentik.dart create mode 100644 lib/src/models/o_auth2_autodesk.dart create mode 100644 lib/src/models/o_auth2_bitbucket.dart create mode 100644 lib/src/models/o_auth2_bitly.dart create mode 100644 lib/src/models/o_auth2_box.dart create mode 100644 lib/src/models/o_auth2_dailymotion.dart create mode 100644 lib/src/models/o_auth2_discord.dart create mode 100644 lib/src/models/o_auth2_disqus.dart create mode 100644 lib/src/models/o_auth2_dropbox.dart create mode 100644 lib/src/models/o_auth2_etsy.dart create mode 100644 lib/src/models/o_auth2_facebook.dart create mode 100644 lib/src/models/o_auth2_figma.dart create mode 100644 lib/src/models/o_auth2_fusion_auth.dart create mode 100644 lib/src/models/o_auth2_github.dart create mode 100644 lib/src/models/o_auth2_gitlab.dart create mode 100644 lib/src/models/o_auth2_google.dart create mode 100644 lib/src/models/o_auth2_keycloak.dart create mode 100644 lib/src/models/o_auth2_kick.dart create mode 100644 lib/src/models/o_auth2_linkedin.dart create mode 100644 lib/src/models/o_auth2_microsoft.dart create mode 100644 lib/src/models/o_auth2_notion.dart create mode 100644 lib/src/models/o_auth2_oidc.dart create mode 100644 lib/src/models/o_auth2_okta.dart create mode 100644 lib/src/models/o_auth2_paypal.dart create mode 100644 lib/src/models/o_auth2_podio.dart create mode 100644 lib/src/models/o_auth2_provider_list.dart create mode 100644 lib/src/models/o_auth2_salesforce.dart create mode 100644 lib/src/models/o_auth2_slack.dart create mode 100644 lib/src/models/o_auth2_spotify.dart create mode 100644 lib/src/models/o_auth2_stripe.dart create mode 100644 lib/src/models/o_auth2_tradeshift.dart create mode 100644 lib/src/models/o_auth2_twitch.dart create mode 100644 lib/src/models/o_auth2_word_press.dart create mode 100644 lib/src/models/o_auth2_x.dart create mode 100644 lib/src/models/o_auth2_yahoo.dart create mode 100644 lib/src/models/o_auth2_yandex.dart create mode 100644 lib/src/models/o_auth2_zoho.dart create mode 100644 lib/src/models/o_auth2_zoom.dart create mode 100644 lib/src/models/policy_list.dart create mode 100644 lib/src/models/policy_membership_privacy.dart create mode 100644 lib/src/models/policy_password_dictionary.dart create mode 100644 lib/src/models/policy_password_history.dart create mode 100644 lib/src/models/policy_password_personal_data.dart create mode 100644 lib/src/models/policy_session_alert.dart create mode 100644 lib/src/models/policy_session_duration.dart create mode 100644 lib/src/models/policy_session_invalidation.dart create mode 100644 lib/src/models/policy_session_limit.dart create mode 100644 lib/src/models/policy_user_limit.dart create mode 100644 lib/src/models/presence.dart create mode 100644 lib/src/models/presence_list.dart create mode 100644 lib/src/models/proxy_rule.dart create mode 100644 lib/src/models/proxy_rule_list.dart create mode 100644 test/services/presences_test.dart create mode 100644 test/services/proxy_test.dart create mode 100644 test/src/models/attribute_bigint_test.dart create mode 100644 test/src/models/column_bigint_test.dart create mode 100644 test/src/models/email_template_list_test.dart create mode 100644 test/src/models/email_template_test.dart create mode 100644 test/src/models/ephemeral_key_test.dart create mode 100644 test/src/models/mock_number_list_test.dart create mode 100644 test/src/models/o_auth2_amazon_test.dart create mode 100644 test/src/models/o_auth2_apple_test.dart create mode 100644 test/src/models/o_auth2_auth0_test.dart create mode 100644 test/src/models/o_auth2_authentik_test.dart create mode 100644 test/src/models/o_auth2_autodesk_test.dart create mode 100644 test/src/models/o_auth2_bitbucket_test.dart create mode 100644 test/src/models/o_auth2_bitly_test.dart create mode 100644 test/src/models/o_auth2_box_test.dart create mode 100644 test/src/models/o_auth2_dailymotion_test.dart create mode 100644 test/src/models/o_auth2_discord_test.dart create mode 100644 test/src/models/o_auth2_disqus_test.dart create mode 100644 test/src/models/o_auth2_dropbox_test.dart create mode 100644 test/src/models/o_auth2_etsy_test.dart create mode 100644 test/src/models/o_auth2_facebook_test.dart create mode 100644 test/src/models/o_auth2_figma_test.dart create mode 100644 test/src/models/o_auth2_fusion_auth_test.dart create mode 100644 test/src/models/o_auth2_github_test.dart create mode 100644 test/src/models/o_auth2_gitlab_test.dart create mode 100644 test/src/models/o_auth2_google_test.dart create mode 100644 test/src/models/o_auth2_keycloak_test.dart create mode 100644 test/src/models/o_auth2_kick_test.dart create mode 100644 test/src/models/o_auth2_linkedin_test.dart create mode 100644 test/src/models/o_auth2_microsoft_test.dart create mode 100644 test/src/models/o_auth2_notion_test.dart create mode 100644 test/src/models/o_auth2_oidc_test.dart create mode 100644 test/src/models/o_auth2_okta_test.dart create mode 100644 test/src/models/o_auth2_paypal_test.dart create mode 100644 test/src/models/o_auth2_podio_test.dart create mode 100644 test/src/models/o_auth2_provider_list_test.dart create mode 100644 test/src/models/o_auth2_salesforce_test.dart create mode 100644 test/src/models/o_auth2_slack_test.dart create mode 100644 test/src/models/o_auth2_spotify_test.dart create mode 100644 test/src/models/o_auth2_stripe_test.dart create mode 100644 test/src/models/o_auth2_tradeshift_test.dart create mode 100644 test/src/models/o_auth2_twitch_test.dart create mode 100644 test/src/models/o_auth2_word_press_test.dart create mode 100644 test/src/models/o_auth2_x_test.dart create mode 100644 test/src/models/o_auth2_yahoo_test.dart create mode 100644 test/src/models/o_auth2_yandex_test.dart create mode 100644 test/src/models/o_auth2_zoho_test.dart create mode 100644 test/src/models/o_auth2_zoom_test.dart create mode 100644 test/src/models/policy_list_test.dart create mode 100644 test/src/models/policy_membership_privacy_test.dart create mode 100644 test/src/models/policy_password_dictionary_test.dart create mode 100644 test/src/models/policy_password_history_test.dart create mode 100644 test/src/models/policy_password_personal_data_test.dart create mode 100644 test/src/models/policy_session_alert_test.dart create mode 100644 test/src/models/policy_session_duration_test.dart create mode 100644 test/src/models/policy_session_invalidation_test.dart create mode 100644 test/src/models/policy_session_limit_test.dart create mode 100644 test/src/models/policy_user_limit_test.dart create mode 100644 test/src/models/presence_list_test.dart create mode 100644 test/src/models/presence_test.dart create mode 100644 test/src/models/proxy_rule_list_test.dart create mode 100644 test/src/models/proxy_rule_test.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 2837ae0c..a5d327a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 23.1.0 + +* Added: Introduced `bigint` create/update APIs for legacy Databases attributes +* Added: Introduced `bigint` create/update APIs for `TablesDB` columns +* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret` + ## 23.0.0 * [BREAKING] Renamed Webhook model fields: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword`, `signatureKey` → `secret` diff --git a/README.md b/README.md index 1af96c04..b5f150d5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).** +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).** > This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check [appwrite/sdk-for-flutter](https://github.com/appwrite/sdk-for-flutter) @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - dart_appwrite: ^23.0.0 + dart_appwrite: ^23.1.0 ``` You can install packages from the command line: diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..2b4cb974 --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeBigint result = await databases.createBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); +``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..e885b89f --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeBigint result = await databases.updateBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); +``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 7c7cf991..48d9ca80 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -10,6 +10,7 @@ Functions functions = Functions(client); Variable result = await functions.createVariable( functionId: '', + variableId: '', key: '', value: '', secret: false, // (optional) diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index c960e9bd..74456309 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -21,7 +21,7 @@ Func result = await functions.create( logging: false, // (optional) entrypoint: '', // (optional) commands: '', // (optional) - scopes: [enums.Scopes.sessionsWrite], // (optional) + scopes: [enums.Scopes.projectRead], // (optional) installationId: '', // (optional) providerRepositoryId: '', // (optional) providerBranch: '', // (optional) diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 0cbd895c..bd07b000 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -10,5 +10,7 @@ Functions functions = Functions(client); VariableList result = await functions.listVariables( functionId: '', + queries: [], // (optional) + total: false, // (optional) ); ``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index be5e0345..e933473f 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -11,7 +11,7 @@ Functions functions = Functions(client); Variable result = await functions.updateVariable( functionId: '', variableId: '', - key: '', + key: '', // (optional) value: '', // (optional) secret: false, // (optional) ); diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index bd99c93f..904f8967 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -21,7 +21,7 @@ Func result = await functions.update( logging: false, // (optional) entrypoint: '', // (optional) commands: '', // (optional) - scopes: [enums.Scopes.sessionsWrite], // (optional) + scopes: [enums.Scopes.projectRead], // (optional) installationId: '', // (optional) providerRepositoryId: '', // (optional) providerBranch: '', // (optional) diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 00000000..50c950a6 --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +await presences.delete( + presenceId: '', +); +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 00000000..f8025297 --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +Presence result = await presences.get( + presenceId: '', +); +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 00000000..d0a87bb1 --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +PresenceList result = await presences.list( + queries: [], // (optional) + total: false, // (optional) + ttl: 0, // (optional) +); +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 00000000..445afd19 --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,22 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/permission.dart'; +import 'package:dart_appwrite/role.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +Presence result = await presences.updatePresence( + presenceId: '', + userId: '', + status: '', // (optional) + expiresAt: '2020-10-15T06:38:00.000+00:00', // (optional) + metadata: {}, // (optional) + permissions: [Permission.read(Role.any())], // (optional) + purge: false, // (optional) +); +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 00000000..7602a2eb --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/permission.dart'; +import 'package:dart_appwrite/role.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Presences presences = Presences(client); + +Presence result = await presences.upsert( + presenceId: '', + userId: '', + status: '', + permissions: [Permission.read(Role.any())], // (optional) + expiresAt: '2020-10-15T06:38:00.000+00:00', // (optional) + metadata: {}, // (optional) +); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md new file mode 100644 index 00000000..dda5801e --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EphemeralKey result = await project.createEphemeralKey( + scopes: [enums.Scopes.projectRead], + duration: 600, +); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 9c63e3bf..9e1d8e8e 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -12,7 +12,7 @@ Project project = Project(client); Key result = await project.createKey( keyId: '', name: '', - scopes: [enums.Scopes.sessionsWrite], + scopes: [enums.Scopes.projectRead], expire: '2020-10-15T06:38:00.000+00:00', // (optional) ); ``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md new file mode 100644 index 00000000..c73c4c2f --- /dev/null +++ b/docs/examples/project/create-mock-phone.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumber result = await project.createMockPhone( + number: '+12065550100', + otp: '', +); +``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 00000000..fac73da8 --- /dev/null +++ b/docs/examples/project/create-smtp-test.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + + result = await project.createSMTPTest( + emails: [], +); +``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..f47a2190 --- /dev/null +++ b/docs/examples/project/delete-mock-phone.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +await project.deleteMockPhone( + number: '+12065550100', +); +``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..3199e2db --- /dev/null +++ b/docs/examples/project/delete.md @@ -0,0 +1,12 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +await project.delete(); +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 00000000..798a0186 --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EmailTemplate result = await project.getEmailTemplate( + templateId: enums.EmailTemplateType.verification, + locale: enums.EmailTemplateLocale.af, // (optional) +); +``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md new file mode 100644 index 00000000..e3ef61ff --- /dev/null +++ b/docs/examples/project/get-mock-phone.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumber result = await project.getMockPhone( + number: '+12065550100', +); +``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md new file mode 100644 index 00000000..77ccd41a --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +dynamic result = await project.getOAuth2Provider( + providerId: enums.ProviderId.amazon, +); +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..55eae16f --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +dynamic result = await project.getPolicy( + policyId: enums.PolicyId.passwordDictionary, +); +``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..0bd9ee7e --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EmailTemplateList result = await project.listEmailTemplates( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..dac64397 --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumberList result = await project.listMockPhones( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md new file mode 100644 index 00000000..b69c5273 --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2ProviderList result = await project.listOAuth2Providers( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..5aba661c --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +PolicyList result = await project.listPolicies( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..94b5245d --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateAuthMethod( + methodId: enums.MethodId.emailPassword, + enabled: false, +); +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 00000000..a378f794 --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,22 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +EmailTemplate result = await project.updateEmailTemplate( + templateId: enums.EmailTemplateType.verification, + locale: enums.EmailTemplateLocale.af, // (optional) + subject: '', // (optional) + message: '', // (optional) + senderName: '', // (optional) + senderEmail: 'email@example.com', // (optional) + replyToEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) +); +``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 83f4139c..86379d8c 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -12,7 +12,7 @@ Project project = Project(client); Key result = await project.updateKey( keyId: '', name: '', - scopes: [enums.Scopes.sessionsWrite], + scopes: [enums.Scopes.projectRead], expire: '2020-10-15T06:38:00.000+00:00', // (optional) ); ``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md new file mode 100644 index 00000000..df34e2c4 --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateMembershipPrivacyPolicy( + userId: false, // (optional) + userEmail: false, // (optional) + userPhone: false, // (optional) + userName: false, // (optional) + userMFA: false, // (optional) +); +``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..3f584d21 --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +MockNumber result = await project.updateMockPhone( + number: '+12065550100', + otp: '', +); +``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md new file mode 100644 index 00000000..1821f5d8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Amazon result = await project.updateOAuth2Amazon( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md new file mode 100644 index 00000000..06f506e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Apple result = await project.updateOAuth2Apple( + serviceId: '', // (optional) + keyId: '', // (optional) + teamId: '', // (optional) + p8File: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md new file mode 100644 index 00000000..e00a5976 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Auth0 result = await project.updateOAuth2Auth0( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md new file mode 100644 index 00000000..73470273 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Authentik result = await project.updateOAuth2Authentik( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md new file mode 100644 index 00000000..1273e6e4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Autodesk result = await project.updateOAuth2Autodesk( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md new file mode 100644 index 00000000..2f9274a0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Bitbucket result = await project.updateOAuth2Bitbucket( + key: '', // (optional) + secret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md new file mode 100644 index 00000000..5f03c82e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Bitly result = await project.updateOAuth2Bitly( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md new file mode 100644 index 00000000..b00ab7c5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Box result = await project.updateOAuth2Box( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md new file mode 100644 index 00000000..1117cf85 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Dailymotion result = await project.updateOAuth2Dailymotion( + apiKey: '', // (optional) + apiSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md new file mode 100644 index 00000000..7e06450d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Discord result = await project.updateOAuth2Discord( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md new file mode 100644 index 00000000..42d62a82 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Disqus result = await project.updateOAuth2Disqus( + publicKey: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md new file mode 100644 index 00000000..20082912 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Dropbox result = await project.updateOAuth2Dropbox( + appKey: '', // (optional) + appSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md new file mode 100644 index 00000000..3e6118a1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Etsy result = await project.updateOAuth2Etsy( + keyString: '', // (optional) + sharedSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md new file mode 100644 index 00000000..48d282a9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Facebook result = await project.updateOAuth2Facebook( + appId: '', // (optional) + appSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md new file mode 100644 index 00000000..1b80d0e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Figma result = await project.updateOAuth2Figma( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md new file mode 100644 index 00000000..73c41171 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2FusionAuth result = await project.updateOAuth2FusionAuth( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md new file mode 100644 index 00000000..e2830382 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Github result = await project.updateOAuth2GitHub( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md new file mode 100644 index 00000000..1d7418d9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Gitlab result = await project.updateOAuth2Gitlab( + applicationId: '', // (optional) + secret: '', // (optional) + endpoint: 'https://example.com', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md new file mode 100644 index 00000000..c96f80e5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Google result = await project.updateOAuth2Google( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md new file mode 100644 index 00000000..b7195b82 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Keycloak result = await project.updateOAuth2Keycloak( + clientId: '', // (optional) + clientSecret: '', // (optional) + endpoint: '', // (optional) + realmName: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md new file mode 100644 index 00000000..5cfdf9a4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Kick result = await project.updateOAuth2Kick( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md new file mode 100644 index 00000000..d69f1eaa --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Linkedin result = await project.updateOAuth2Linkedin( + clientId: '', // (optional) + primaryClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md new file mode 100644 index 00000000..7f1aa6ca --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,17 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Microsoft result = await project.updateOAuth2Microsoft( + applicationId: '', // (optional) + applicationSecret: '', // (optional) + tenant: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md new file mode 100644 index 00000000..ba723ccc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Notion result = await project.updateOAuth2Notion( + oauthClientId: '', // (optional) + oauthClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md new file mode 100644 index 00000000..4784bf46 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,20 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Oidc result = await project.updateOAuth2Oidc( + clientId: '', // (optional) + clientSecret: '', // (optional) + wellKnownURL: 'https://example.com', // (optional) + authorizationURL: 'https://example.com', // (optional) + tokenURL: 'https://example.com', // (optional) + userInfoURL: 'https://example.com', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md new file mode 100644 index 00000000..1b79a5e6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,18 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Okta result = await project.updateOAuth2Okta( + clientId: '', // (optional) + clientSecret: '', // (optional) + domain: '', // (optional) + authorizationServerId: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md new file mode 100644 index 00000000..eda05f5e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Paypal result = await project.updateOAuth2PaypalSandbox( + clientId: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md new file mode 100644 index 00000000..120b5817 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Paypal result = await project.updateOAuth2Paypal( + clientId: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md new file mode 100644 index 00000000..9b5ee737 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Podio result = await project.updateOAuth2Podio( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md new file mode 100644 index 00000000..6be026b4 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Salesforce result = await project.updateOAuth2Salesforce( + customerKey: '', // (optional) + customerSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md new file mode 100644 index 00000000..1032810c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Slack result = await project.updateOAuth2Slack( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md new file mode 100644 index 00000000..8e7f9834 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Spotify result = await project.updateOAuth2Spotify( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md new file mode 100644 index 00000000..36746673 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Stripe result = await project.updateOAuth2Stripe( + clientId: '', // (optional) + apiSecretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md new file mode 100644 index 00000000..653abf6e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Tradeshift result = await project.updateOAuth2TradeshiftSandbox( + oauth2ClientId: '', // (optional) + oauth2ClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md new file mode 100644 index 00000000..1e780bfc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Tradeshift result = await project.updateOAuth2Tradeshift( + oauth2ClientId: '', // (optional) + oauth2ClientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md new file mode 100644 index 00000000..93d29acd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Twitch result = await project.updateOAuth2Twitch( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md new file mode 100644 index 00000000..32e3495a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2WordPress result = await project.updateOAuth2WordPress( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md new file mode 100644 index 00000000..f08d5074 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Yahoo result = await project.updateOAuth2Yahoo( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md new file mode 100644 index 00000000..4106fe67 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Yandex result = await project.updateOAuth2Yandex( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md new file mode 100644 index 00000000..69d44d8a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Zoho result = await project.updateOAuth2Zoho( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md new file mode 100644 index 00000000..d91ddcbd --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2Zoom result = await project.updateOAuth2Zoom( + clientId: '', // (optional) + clientSecret: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md new file mode 100644 index 00000000..bf7e5f62 --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +OAuth2X result = await project.updateOAuth2X( + customerKey: '', // (optional) + secretKey: '', // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md new file mode 100644 index 00000000..9d07cff3 --- /dev/null +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updatePasswordDictionaryPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md new file mode 100644 index 00000000..2d5ca13e --- /dev/null +++ b/docs/examples/project/update-password-history-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updatePasswordHistoryPolicy( + total: 1, +); +``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md new file mode 100644 index 00000000..51680b7d --- /dev/null +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updatePasswordPersonalDataPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-protocol-status.md b/docs/examples/project/update-protocol.md similarity index 89% rename from docs/examples/project/update-protocol-status.md rename to docs/examples/project/update-protocol.md index 721651af..86501059 100644 --- a/docs/examples/project/update-protocol-status.md +++ b/docs/examples/project/update-protocol.md @@ -9,7 +9,7 @@ Client client = Client() Project project = Project(client); -Project result = await project.updateProtocolStatus( +Project result = await project.updateProtocol( protocolId: enums.ProtocolId.rest, enabled: false, ); diff --git a/docs/examples/project/update-service-status.md b/docs/examples/project/update-service.md similarity index 89% rename from docs/examples/project/update-service-status.md rename to docs/examples/project/update-service.md index 59487ddd..828b640a 100644 --- a/docs/examples/project/update-service-status.md +++ b/docs/examples/project/update-service.md @@ -9,7 +9,7 @@ Client client = Client() Project project = Project(client); -Project result = await project.updateServiceStatus( +Project result = await project.updateService( serviceId: enums.ServiceId.account, enabled: false, ); diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md new file mode 100644 index 00000000..a3d892f0 --- /dev/null +++ b/docs/examples/project/update-session-alert-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionAlertPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md new file mode 100644 index 00000000..5b102294 --- /dev/null +++ b/docs/examples/project/update-session-duration-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionDurationPolicy( + duration: 5, +); +``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md new file mode 100644 index 00000000..e38b5180 --- /dev/null +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionInvalidationPolicy( + enabled: false, +); +``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md new file mode 100644 index 00000000..8726970e --- /dev/null +++ b/docs/examples/project/update-session-limit-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSessionLimitPolicy( + total: 1, +); +``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 00000000..ce64a691 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,24 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateSMTP( + host: '', // (optional) + port: 0, // (optional) + username: '', // (optional) + password: '', // (optional) + senderEmail: 'email@example.com', // (optional) + senderName: '', // (optional) + replyToEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) + secure: enums.Secure.tls, // (optional) + enabled: false, // (optional) +); +``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md new file mode 100644 index 00000000..b423abbe --- /dev/null +++ b/docs/examples/project/update-user-limit-policy.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Project project = Project(client); + +Project result = await project.updateUserLimitPolicy( + total: 1, +); +``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md new file mode 100644 index 00000000..cb63b308 --- /dev/null +++ b/docs/examples/proxy/create-api-rule.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createAPIRule( + domain: '', +); +``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md new file mode 100644 index 00000000..64bbbab2 --- /dev/null +++ b/docs/examples/proxy/create-function-rule.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createFunctionRule( + domain: '', + functionId: '', + branch: '', // (optional) +); +``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md new file mode 100644 index 00000000..31357162 --- /dev/null +++ b/docs/examples/proxy/create-redirect-rule.md @@ -0,0 +1,19 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; +import 'package:dart_appwrite/enums.dart' as enums; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createRedirectRule( + domain: '', + url: 'https://example.com', + statusCode: enums.StatusCode.movedPermanently301, + resourceId: '', + resourceType: enums.ProxyResourceType.site, +); +``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md new file mode 100644 index 00000000..912c2acd --- /dev/null +++ b/docs/examples/proxy/create-site-rule.md @@ -0,0 +1,16 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.createSiteRule( + domain: '', + siteId: '', + branch: '', // (optional) +); +``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 00000000..6829f2a1 --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +await proxy.deleteRule( + ruleId: '', +); +``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 00000000..6ade1647 --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.getRule( + ruleId: '', +); +``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 00000000..29931d1d --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,15 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRuleList result = await proxy.listRules( + queries: [], // (optional) + total: false, // (optional) +); +``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md new file mode 100644 index 00000000..00c62dff --- /dev/null +++ b/docs/examples/proxy/update-rule-status.md @@ -0,0 +1,14 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Proxy proxy = Proxy(client); + +ProxyRule result = await proxy.updateRuleStatus( + ruleId: '', +); +``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index d4c23fd6..0144bec0 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -10,6 +10,7 @@ Sites sites = Sites(client); Variable result = await sites.createVariable( siteId: '', + variableId: '', key: '', value: '', secret: false, // (optional) diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 13777583..2f226ed6 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -10,5 +10,7 @@ Sites sites = Sites(client); VariableList result = await sites.listVariables( siteId: '', + queries: [], // (optional) + total: false, // (optional) ); ``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 8fb4b42d..24a135ea 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -11,7 +11,7 @@ Sites sites = Sites(client); Variable result = await sites.updateVariable( siteId: '', variableId: '', - key: '', + key: '', // (optional) value: '', // (optional) secret: false, // (optional) ); diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md new file mode 100644 index 00000000..c5d2656a --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +TablesDB tablesDB = TablesDB(client); + +ColumnBigint result = await tablesDB.createBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); +``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..c96db0d0 --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,21 @@ +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +TablesDB tablesDB = TablesDB(client); + +ColumnBigint result = await tablesDB.updateBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); +``` diff --git a/lib/client_browser.dart b/lib/client_browser.dart index b9805a3a..09f110ea 100644 --- a/lib/client_browser.dart +++ b/lib/client_browser.dart @@ -1 +1 @@ -export 'src/client_browser.dart'; +export 'src/client_browser.dart'; \ No newline at end of file diff --git a/lib/client_io.dart b/lib/client_io.dart index 42a0c0b6..4d85cbfa 100644 --- a/lib/client_io.dart +++ b/lib/client_io.dart @@ -1 +1 @@ -export 'src/client_io.dart'; +export 'src/client_io.dart'; \ No newline at end of file diff --git a/lib/dart_appwrite.dart b/lib/dart_appwrite.dart index 371d4cab..eed40431 100644 --- a/lib/dart_appwrite.dart +++ b/lib/dart_appwrite.dart @@ -38,7 +38,9 @@ part 'services/graphql.dart'; part 'services/health.dart'; part 'services/locale.dart'; part 'services/messaging.dart'; +part 'services/presences.dart'; part 'services/project.dart'; +part 'services/proxy.dart'; part 'services/sites.dart'; part 'services/storage.dart'; part 'services/tables_db.dart'; diff --git a/lib/enums.dart b/lib/enums.dart index ac0ee55a..f628ed59 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -25,8 +25,16 @@ part 'src/enums/execution_method.dart'; part 'src/enums/name.dart'; part 'src/enums/message_priority.dart'; part 'src/enums/smtp_encryption.dart'; +part 'src/enums/method_id.dart'; +part 'src/enums/provider_id.dart'; +part 'src/enums/policy_id.dart'; part 'src/enums/protocol_id.dart'; part 'src/enums/service_id.dart'; +part 'src/enums/secure.dart'; +part 'src/enums/email_template_type.dart'; +part 'src/enums/email_template_locale.dart'; +part 'src/enums/status_code.dart'; +part 'src/enums/proxy_resource_type.dart'; part 'src/enums/framework.dart'; part 'src/enums/build_runtime.dart'; part 'src/enums/adapter.dart'; @@ -45,4 +53,6 @@ part 'src/enums/execution_status.dart'; part 'src/enums/platform_type.dart'; part 'src/enums/health_antivirus_status.dart'; part 'src/enums/health_check_status.dart'; +part 'src/enums/proxy_rule_deployment_resource_type.dart'; +part 'src/enums/proxy_rule_status.dart'; part 'src/enums/message_status.dart'; diff --git a/lib/models.dart b/lib/models.dart index 5af3de6c..26758564 100644 --- a/lib/models.dart +++ b/lib/models.dart @@ -6,6 +6,7 @@ import 'enums.dart' as enums; part 'src/models/model.dart'; part 'src/models/row_list.dart'; part 'src/models/document_list.dart'; +part 'src/models/presence_list.dart'; part 'src/models/table_list.dart'; part 'src/models/collection_list.dart'; part 'src/models/database_list.dart'; @@ -34,7 +35,11 @@ part 'src/models/language_list.dart'; part 'src/models/currency_list.dart'; part 'src/models/phone_list.dart'; part 'src/models/variable_list.dart'; +part 'src/models/mock_number_list.dart'; +part 'src/models/policy_list.dart'; +part 'src/models/email_template_list.dart'; part 'src/models/health_status_list.dart'; +part 'src/models/proxy_rule_list.dart'; part 'src/models/locale_code_list.dart'; part 'src/models/provider_list.dart'; part 'src/models/message_list.dart'; @@ -48,6 +53,7 @@ part 'src/models/collection.dart'; part 'src/models/attribute_list.dart'; part 'src/models/attribute_string.dart'; part 'src/models/attribute_integer.dart'; +part 'src/models/attribute_bigint.dart'; part 'src/models/attribute_float.dart'; part 'src/models/attribute_boolean.dart'; part 'src/models/attribute_email.dart'; @@ -67,6 +73,7 @@ part 'src/models/table.dart'; part 'src/models/column_list.dart'; part 'src/models/column_string.dart'; part 'src/models/column_integer.dart'; +part 'src/models/column_bigint.dart'; part 'src/models/column_float.dart'; part 'src/models/column_boolean.dart'; part 'src/models/column_email.dart'; @@ -86,6 +93,7 @@ part 'src/models/index.dart'; part 'src/models/column_index.dart'; part 'src/models/row.dart'; part 'src/models/document.dart'; +part 'src/models/presence.dart'; part 'src/models/log.dart'; part 'src/models/user.dart'; part 'src/models/algo_md5.dart'; @@ -117,8 +125,59 @@ part 'src/models/execution.dart'; part 'src/models/project.dart'; part 'src/models/webhook.dart'; part 'src/models/key.dart'; +part 'src/models/ephemeral_key.dart'; part 'src/models/dev_key.dart'; part 'src/models/mock_number.dart'; +part 'src/models/o_auth2_github.dart'; +part 'src/models/o_auth2_discord.dart'; +part 'src/models/o_auth2_figma.dart'; +part 'src/models/o_auth2_dropbox.dart'; +part 'src/models/o_auth2_dailymotion.dart'; +part 'src/models/o_auth2_bitbucket.dart'; +part 'src/models/o_auth2_bitly.dart'; +part 'src/models/o_auth2_box.dart'; +part 'src/models/o_auth2_autodesk.dart'; +part 'src/models/o_auth2_google.dart'; +part 'src/models/o_auth2_zoom.dart'; +part 'src/models/o_auth2_zoho.dart'; +part 'src/models/o_auth2_yandex.dart'; +part 'src/models/o_auth2_x.dart'; +part 'src/models/o_auth2_word_press.dart'; +part 'src/models/o_auth2_twitch.dart'; +part 'src/models/o_auth2_stripe.dart'; +part 'src/models/o_auth2_spotify.dart'; +part 'src/models/o_auth2_slack.dart'; +part 'src/models/o_auth2_podio.dart'; +part 'src/models/o_auth2_notion.dart'; +part 'src/models/o_auth2_salesforce.dart'; +part 'src/models/o_auth2_yahoo.dart'; +part 'src/models/o_auth2_linkedin.dart'; +part 'src/models/o_auth2_disqus.dart'; +part 'src/models/o_auth2_amazon.dart'; +part 'src/models/o_auth2_etsy.dart'; +part 'src/models/o_auth2_facebook.dart'; +part 'src/models/o_auth2_tradeshift.dart'; +part 'src/models/o_auth2_paypal.dart'; +part 'src/models/o_auth2_gitlab.dart'; +part 'src/models/o_auth2_authentik.dart'; +part 'src/models/o_auth2_auth0.dart'; +part 'src/models/o_auth2_fusion_auth.dart'; +part 'src/models/o_auth2_keycloak.dart'; +part 'src/models/o_auth2_oidc.dart'; +part 'src/models/o_auth2_okta.dart'; +part 'src/models/o_auth2_kick.dart'; +part 'src/models/o_auth2_apple.dart'; +part 'src/models/o_auth2_microsoft.dart'; +part 'src/models/o_auth2_provider_list.dart'; +part 'src/models/policy_password_dictionary.dart'; +part 'src/models/policy_password_history.dart'; +part 'src/models/policy_password_personal_data.dart'; +part 'src/models/policy_session_alert.dart'; +part 'src/models/policy_session_duration.dart'; +part 'src/models/policy_session_invalidation.dart'; +part 'src/models/policy_session_limit.dart'; +part 'src/models/policy_user_limit.dart'; +part 'src/models/policy_membership_privacy.dart'; part 'src/models/auth_provider.dart'; part 'src/models/platform_web.dart'; part 'src/models/platform_apple.dart'; @@ -139,6 +198,8 @@ part 'src/models/health_certificate.dart'; part 'src/models/health_time.dart'; part 'src/models/headers.dart'; part 'src/models/specification.dart'; +part 'src/models/proxy_rule.dart'; +part 'src/models/email_template.dart'; part 'src/models/mfa_challenge.dart'; part 'src/models/mfa_recovery_codes.dart'; part 'src/models/mfa_type.dart'; diff --git a/lib/operator.dart b/lib/operator.dart index 6572e0e5..e2e4c84d 100644 --- a/lib/operator.dart +++ b/lib/operator.dart @@ -31,7 +31,7 @@ class Operator { result['method'] = method; - if (values != null) { + if(values != null) { result['values'] = values is List ? values : [values]; } @@ -147,7 +147,8 @@ class Operator { Operator._('arrayRemove', [value]).toString(); /// Remove duplicate values from an array attribute. - static String arrayUnique() => Operator._('arrayUnique', []).toString(); + static String arrayUnique() => + Operator._('arrayUnique', []).toString(); /// Keep only values that exist in both the current array and the provided array. static String arrayIntersect(List values) => @@ -172,7 +173,8 @@ class Operator { Operator._('stringReplace', [search, replace]).toString(); /// Toggle a boolean attribute. - static String toggle() => Operator._('toggle', []).toString(); + static String toggle() => + Operator._('toggle', []).toString(); /// Add days to a date attribute. static String dateAddDays(int days) => @@ -183,5 +185,6 @@ class Operator { Operator._('dateSubDays', [days]).toString(); /// Set a date attribute to the current date and time. - static String dateSetNow() => Operator._('dateSetNow', []).toString(); + static String dateSetNow() => + Operator._('dateSetNow', []).toString(); } diff --git a/lib/query.dart b/lib/query.dart index 1ee04fa4..c643a4be 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -10,14 +10,14 @@ class Query { Map toJson() { final result = {}; - + result['method'] = method; - - if (attribute != null) { + + if(attribute != null) { result['attribute'] = attribute; } - - if (values != null) { + + if(values != null) { result['values'] = values is List ? values : [values]; } @@ -28,7 +28,7 @@ class Query { String toString() => jsonEncode(toJson()); /// Filter resources where [attribute] is equal to [value]. - /// + /// /// [value] can be a single value or a list. If a list is used /// the query will return resources where [attribute] is equal /// to any of the values in the list. @@ -140,46 +140,50 @@ class Query { Query._('notEndsWith', attribute, value).toString(); /// Filter resources where document was created before [value]. - static String createdBefore(String value) => lessThan('\$createdAt', value); + static String createdBefore(String value) => + lessThan('\$createdAt', value); /// Filter resources where document was created after [value]. - static String createdAfter(String value) => greaterThan('\$createdAt', value); + static String createdAfter(String value) => + greaterThan('\$createdAt', value); /// Filter resources where document was created between [start] and [end] (inclusive). static String createdBetween(String start, String end) => between('\$createdAt', start, end); /// Filter resources where document was updated before [value]. - static String updatedBefore(String value) => lessThan('\$updatedAt', value); + static String updatedBefore(String value) => + lessThan('\$updatedAt', value); /// Filter resources where document was updated after [value]. - static String updatedAfter(String value) => greaterThan('\$updatedAt', value); + static String updatedAfter(String value) => + greaterThan('\$updatedAt', value); /// Filter resources where document was updated between [start] and [end] (inclusive). static String updatedBetween(String start, String end) => between('\$updatedAt', start, end); static String or(List queries) => Query._( - 'or', - null, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + 'or', + null, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); static String and(List queries) => Query._( - 'and', - null, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + 'and', + null, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); /// Filter array elements where at least one element matches all the specified queries. /// /// [attribute] The attribute containing the array to filter on. /// [queries] The list of query strings to match against array elements. static String elemMatch(String attribute, List queries) => Query._( - 'elemMatch', - attribute, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + 'elemMatch', + attribute, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); /// Specify which attributes should be returned by the API call. static String select(List attributes) => @@ -194,17 +198,18 @@ class Query { Query._('orderDesc', attribute).toString(); /// Sort results randomly. - static String orderRandom() => Query._('orderRandom').toString(); + static String orderRandom() => + Query._('orderRandom').toString(); /// Return results before [id]. - /// + /// /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) /// docs for more information. static String cursorBefore(String id) => Query._('cursorBefore', null, id).toString(); /// Return results after [id]. - /// + /// /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) /// docs for more information. static String cursorAfter(String id) => @@ -214,43 +219,27 @@ class Query { static String limit(int limit) => Query._('limit', null, limit).toString(); /// Return results from [offset]. - /// + /// /// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination) /// docs for more information. static String offset(int offset) => Query._('offset', null, offset).toString(); /// Filter resources where [attribute] is at a specific distance from the given coordinates. - static String distanceEqual( - String attribute, List values, num distance, - [bool meters = true]) => - Query._('distanceEqual', attribute, [ - [values, distance, meters] - ]).toString(); + static String distanceEqual(String attribute, List values, num distance, [bool meters = true]) => + Query._('distanceEqual', attribute, [[values, distance, meters]]).toString(); /// Filter resources where [attribute] is not at a specific distance from the given coordinates. - static String distanceNotEqual( - String attribute, List values, num distance, - [bool meters = true]) => - Query._('distanceNotEqual', attribute, [ - [values, distance, meters] - ]).toString(); + static String distanceNotEqual(String attribute, List values, num distance, [bool meters = true]) => + Query._('distanceNotEqual', attribute, [[values, distance, meters]]).toString(); /// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates. - static String distanceGreaterThan( - String attribute, List values, num distance, - [bool meters = true]) => - Query._('distanceGreaterThan', attribute, [ - [values, distance, meters] - ]).toString(); + static String distanceGreaterThan(String attribute, List values, num distance, [bool meters = true]) => + Query._('distanceGreaterThan', attribute, [[values, distance, meters]]).toString(); /// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates. - static String distanceLessThan( - String attribute, List values, num distance, - [bool meters = true]) => - Query._('distanceLessThan', attribute, [ - [values, distance, meters] - ]).toString(); + static String distanceLessThan(String attribute, List values, num distance, [bool meters = true]) => + Query._('distanceLessThan', attribute, [[values, distance, meters]]).toString(); /// Filter resources where [attribute] intersects with the given geometry. static String intersects(String attribute, List values) => @@ -283,4 +272,4 @@ class Query { /// Filter resources where [attribute] does not touch the given geometry. static String notTouches(String attribute, List values) => Query._('notTouches', attribute, [values]).toString(); -} +} \ No newline at end of file diff --git a/lib/role.dart b/lib/role.dart index dafeb78d..9208f5b6 100644 --- a/lib/role.dart +++ b/lib/role.dart @@ -63,4 +63,4 @@ class Role { static String label(String name) { return 'label:$name'; } -} +} \ No newline at end of file diff --git a/lib/services/account.dart b/lib/services/account.dart index f1c16b65..51676a9d 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,22 +1,27 @@ part of '../dart_appwrite.dart'; -/// The Account service allows you to authenticate and manage a user account. + /// The Account service allows you to authenticate and manage a user account. class Account extends Service { - Account(super.client); + Account(super.client); /// Get the currently logged in user. - Future get() async { - final String apiPath = '/account'; + Future get() async { + final String apiPath = '/account'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Use this endpoint to allow a new user to register a new account in your /// project. After the user registration completes successfully, you can use @@ -25,29 +30,28 @@ class Account extends Service { /// route to start verifying the user email address. To allow the new user to /// login to their new account, you need to create a new [account /// session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). - Future create( - {required String userId, - required String email, - required String password, - String? name}) async { - final String apiPath = '/account'; + Future create({required String userId, required String email, required String password, String? name}) async { + final String apiPath = '/account'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - if (name != null) 'name': name, +'email': email, +'password': password, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Update currently logged in user account email address. After changing user /// address, the user confirmation status will get reset. A new confirmation @@ -56,584 +60,664 @@ class Account extends Service { /// user password is required to complete this request. /// This endpoint can also be used to convert an anonymous account to a normal /// one, by passing an email address and a new password. - /// - Future updateEmail( - {required String email, required String password}) async { - final String apiPath = '/account/email'; + /// + Future updateEmail({required String email, required String password}) async { + final String apiPath = '/account/email'; final Map apiParams = { + 'email': email, - 'password': password, +'password': password, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Get the list of identities for the currently logged in user. - Future listIdentities( - {List? queries, bool? total}) async { - final String apiPath = '/account/identities'; + Future listIdentities({List? queries, bool? total}) async { + final String apiPath = '/account/identities'; final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.IdentityList.fromMap(res.data); - } + + } /// Delete an identity by its unique ID. - Future deleteIdentity({required String identityId}) async { - final String apiPath = '/account/identities/{identityId}' - .replaceAll('{identityId}', identityId); + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}'.replaceAll('{identityId}', identityId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Use this endpoint to create a JSON Web Token. You can use the resulting JWT /// to authenticate on behalf of the current user when working with the /// Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes /// from its creation and will be invalid if the user will logout in that time /// frame. - Future createJWT({int? duration}) async { - final String apiPath = '/account/jwts'; + Future createJWT({int? duration}) async { + final String apiPath = '/account/jwts'; final Map apiParams = { + if (duration != null) 'duration': duration, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Jwt.fromMap(res.data); - } + + } /// Get the list of latest security activity logs for the currently logged in /// user. Each log returns user IP address, location and date and time of log. - Future listLogs({List? queries, bool? total}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries, bool? total}) async { + final String apiPath = '/account/logs'; final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - } + + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; + Future updateMFA({required bool mfa}) async { + final String apiPath = '/account/mfa'; final Map apiParams = { + 'mfa': mfa, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Add an authenticator app to be used as an MFA factor. Verify the /// authenticator using the [verify /// authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.') - Future createMfaAuthenticator( - {required enums.AuthenticatorType type}) async { - final String apiPath = - '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.') + Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaType.fromMap(res.data); - } + + } /// Add an authenticator app to be used as an MFA factor. Verify the /// authenticator using the [verify /// authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) /// method. - Future createMFAAuthenticator( - {required enums.AuthenticatorType type}) async { - final String apiPath = - '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + Future createMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaType.fromMap(res.data); - } + + } /// Verify an authenticator app after adding it using the [add /// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.') - Future updateMfaAuthenticator( - {required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = - '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.') + Future updateMfaAuthenticator({required enums.AuthenticatorType type, required String otp}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); final Map apiParams = { + 'otp': otp, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Verify an authenticator app after adding it using the [add /// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) /// method. - Future updateMFAAuthenticator( - {required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = - '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + Future updateMFAAuthenticator({required enums.AuthenticatorType type, required String otp}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); final Map apiParams = { + 'otp': otp, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Delete an authenticator for a user by ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.') - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = - '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.') + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Delete an authenticator for a user by ID. - Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = - '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Begin the process of MFA verification after sign-in. Finish the flow with /// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.') - Future createMfaChallenge( - {required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenges'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.') + Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { + 'factor': factor.value, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaChallenge.fromMap(res.data); - } + + } /// Begin the process of MFA verification after sign-in. Finish the flow with /// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) /// method. - Future createMFAChallenge( - {required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenges'; + Future createMFAChallenge({required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { + 'factor': factor.value, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaChallenge.fromMap(res.data); - } + + } /// Complete the MFA challenge by providing the one-time password. Finish the /// process of MFA verification by providing the one-time password. To begin /// the flow, use /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.') - Future updateMfaChallenge( - {required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenges'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.') + Future updateMfaChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Complete the MFA challenge by providing the one-time password. Finish the /// process of MFA verification by providing the one-time password. To begin /// the flow, use /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - Future updateMFAChallenge( - {required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenges'; + Future updateMFAChallenge({required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { + 'challengeId': challengeId, - 'otp': otp, +'otp': otp, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// List the factors available on the account to be used as a MFA challange. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.') - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.') + Future listMfaFactors() async { + final String apiPath = '/account/mfa/factors'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - } + + } /// List the factors available on the account to be used as a MFA challange. - Future listMFAFactors() async { - final String apiPath = '/account/mfa/factors'; + Future listMFAFactors() async { + final String apiPath = '/account/mfa/factors'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - } + + } /// Get recovery codes that can be used as backup for MFA flow. Before getting /// codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to read recovery codes. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.') + Future getMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Get recovery codes that can be used as backup for MFA flow. Before getting /// codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to read recovery codes. - Future getMFARecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + Future getMFARecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Generate recovery codes as backup for MFA flow. It's recommended to /// generate and show then immediately after user successfully adds their /// authehticator. Recovery codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.') + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Generate recovery codes as backup for MFA flow. It's recommended to /// generate and show then immediately after user successfully adds their /// authehticator. Recovery codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - Future createMFARecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + Future createMFARecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Regenerate recovery codes that can be used as backup for MFA flow. Before /// regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to regenreate recovery codes. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Regenerate recovery codes that can be used as backup for MFA flow. Before /// regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to regenreate recovery codes. - Future updateMFARecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + Future updateMFARecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Update currently logged in user account name. - Future updateName({required String name}) async { - final String apiPath = '/account/name'; + Future updateName({required String name}) async { + final String apiPath = '/account/name'; final Map apiParams = { + 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Update currently logged in user password. For validation, user is required /// to pass in the new password, and the old password. For users created with /// OAuth, Team Invites and Magic URL, oldPassword is optional. - Future updatePassword( - {required String password, String? oldPassword}) async { - final String apiPath = '/account/password'; + Future updatePassword({required String password, String? oldPassword}) async { + final String apiPath = '/account/password'; final Map apiParams = { + 'password': password, - if (oldPassword != null) 'oldPassword': oldPassword, +if (oldPassword != null) 'oldPassword': oldPassword, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Update the currently logged in user's phone number. After updating the /// phone number, the phone verification status will be reset. A confirmation /// SMS is not sent automatically, however you can use the [POST /// /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) /// endpoint to send a confirmation SMS. - Future updatePhone( - {required String phone, required String password}) async { - final String apiPath = '/account/phone'; + Future updatePhone({required String phone, required String password}) async { + final String apiPath = '/account/phone'; final Map apiParams = { + 'phone': phone, - 'password': password, +'password': password, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Get the preferences as a key-value object for the currently logged in user. - Future getPrefs() async { - final String apiPath = '/account/prefs'; + Future getPrefs() async { + final String apiPath = '/account/prefs'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - } + + } /// Update currently logged in user account preferences. The object you pass is /// stored as is, and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws error if exceeded. - Future updatePrefs({required Map prefs}) async { - final String apiPath = '/account/prefs'; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; final Map apiParams = { + 'prefs': prefs, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Sends the user an email with a temporary secret key for password reset. /// When the user clicks the confirmation link he is redirected back to your @@ -643,88 +727,99 @@ class Account extends Service { /// /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) /// endpoint to complete the process. The verification link sent to the user's /// email address is valid for 1 hour. - Future createRecovery( - {required String email, required String url}) async { - final String apiPath = '/account/recovery'; + Future createRecovery({required String email, required String url}) async { + final String apiPath = '/account/recovery'; final Map apiParams = { + 'email': email, - 'url': url, +'url': url, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to complete the user account password reset. Both the /// **userId** and **secret** arguments will be passed as query parameters to /// the redirect URL you have provided when sending your request to the [POST /// /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) /// endpoint. - /// + /// /// Please note that in order to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - Future updateRecovery( - {required String userId, - required String secret, - required String password}) async { - final String apiPath = '/account/recovery'; + Future updateRecovery({required String userId, required String secret, required String password}) async { + final String apiPath = '/account/recovery'; final Map apiParams = { + 'userId': userId, - 'secret': secret, - 'password': password, +'secret': secret, +'password': password, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Get the list of active sessions across different devices for the currently /// logged in user. - Future listSessions() async { - final String apiPath = '/account/sessions'; + Future listSessions() async { + final String apiPath = '/account/sessions'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.SessionList.fromMap(res.data); - } + + } /// Delete all sessions from the user account and remove any sessions cookies /// from the end client. - Future deleteSessions() async { - final String apiPath = '/account/sessions'; + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Use this endpoint to allow a new user to register an anonymous account in /// your project. This route will also create a new session for the user. To @@ -733,189 +828,213 @@ class Account extends Service { /// password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) /// or create an [OAuth2 /// session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). - Future createAnonymousSession() async { - final String apiPath = '/account/sessions/anonymous'; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Allow the user to login into their account by providing a valid email and /// password combination. This route will create a new session for the user. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - Future createEmailPasswordSession( - {required String email, required String password}) async { - final String apiPath = '/account/sessions/email'; + Future createEmailPasswordSession({required String email, required String password}) async { + final String apiPath = '/account/sessions/email'; final Map apiParams = { + 'email': email, - 'password': password, +'password': password, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. - @Deprecated( - 'This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') - Future updateMagicURLSession( - {required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; + @Deprecated('This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') + Future updateMagicURLSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. - @Deprecated( - 'This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') - Future updatePhoneSession( - {required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; + @Deprecated('This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') + Future updatePhoneSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. - Future createSession( - {required String userId, required String secret}) async { - final String apiPath = '/account/sessions/token'; + Future createSession({required String userId, required String secret}) async { + final String apiPath = '/account/sessions/token'; final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Use this endpoint to get a logged in user's session using a Session ID. /// Inputting 'current' will return the current session being used. - Future getSession({required String sessionId}) async { - final String apiPath = - '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); + Future getSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Use this endpoint to extend a session's length. Extending a session is /// useful when session expiry is short. If the session was created using an /// OAuth provider, this endpoint refreshes the access token from the provider. - Future updateSession({required String sessionId}) async { - final String apiPath = - '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); + Future updateSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Logout the user. Use 'current' as the session ID to logout on this device, /// use a session ID to logout on another device. If you're looking to logout /// the user on all devices, use [Delete /// Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) /// instead. - Future deleteSession({required String sessionId}) async { - final String apiPath = - '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); + Future deleteSession({required String sessionId}) async { + final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Block the currently logged in user account. Behind the scene, the user /// record is not deleted but permanently blocked from any access. To /// completely delete a user, use the Users API instead. - Future updateStatus() async { - final String apiPath = '/account/status'; + Future updateStatus() async { + final String apiPath = '/account/status'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Sends the user an email with a secret key for creating a session. If the /// email address has never been used, a **new account is created** using the @@ -926,30 +1045,32 @@ class Account extends Service { /// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. The secret sent to the user's email /// is valid for 15 minutes. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - /// - Future createEmailToken( - {required String userId, required String email, bool? phrase}) async { - final String apiPath = '/account/tokens/email'; + /// + Future createEmailToken({required String userId, required String email, bool? phrase}) async { + final String apiPath = '/account/tokens/email'; final Map apiParams = { + 'userId': userId, - 'email': email, - if (phrase != null) 'phrase': phrase, +'email': email, +if (phrase != null) 'phrase': phrase, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Sends the user an email with a secret key for creating a session. If the /// provided user ID has not been registered, a new user will be created. When @@ -960,61 +1081,57 @@ class Account extends Service { /// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. The link sent to the user's email /// address is valid for 1 hour. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - /// - Future createMagicURLToken( - {required String userId, - required String email, - String? url, - bool? phrase}) async { - final String apiPath = '/account/tokens/magic-url'; + /// + Future createMagicURLToken({required String userId, required String email, String? url, bool? phrase}) async { + final String apiPath = '/account/tokens/magic-url'; final Map apiParams = { + 'userId': userId, - 'email': email, - if (url != null) 'url': url, - if (phrase != null) 'phrase': phrase, +'email': email, +if (url != null) 'url': url, +if (phrase != null) 'phrase': phrase, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Allow the user to login to their account using the OAuth2 provider of their /// choice. Each OAuth2 provider should be enabled from the Appwrite console /// first. Use the success and failure arguments to provide a redirect URL's - /// back to your app when login is completed. - /// + /// back to your app when login is completed. + /// /// If authentication succeeds, `userId` and `secret` of a token will be /// appended to the success URL as query parameters. These can be used to /// create a new session using the [Create /// session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - Future createOAuth2Token( - {required enums.OAuthProvider provider, - String? success, - String? failure, - List? scopes}) async { - final String apiPath = '/account/tokens/oauth2/{provider}' - .replaceAll('{provider}', provider.value); + Future createOAuth2Token({required enums.OAuthProvider provider, String? success, String? failure, List? scopes}) async { + final String apiPath = '/account/tokens/oauth2/{provider}'.replaceAll('{provider}', provider.value); final Map params = { if (success != null) 'success': success, - if (failure != null) 'failure': failure, - if (scopes != null) 'scopes': scopes, +if (failure != null) 'failure': failure, +if (scopes != null) 'scopes': scopes, + + 'project': client.config['project'], 'session': client.config['session'], }; @@ -1022,7 +1139,7 @@ class Account extends Service { final List query = []; params.forEach((key, value) { - if (value is List) { + if (value is List) { for (var item in value) { query.add( '${Uri.encodeComponent('$key[]')}=${Uri.encodeComponent(item)}'); @@ -1033,15 +1150,15 @@ class Account extends Service { }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri( - scheme: endpoint.scheme, - host: endpoint.host, - port: endpoint.port, - path: endpoint.path + apiPath, - query: query.join('&')); + Uri url = Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + apiPath, + query: query.join('&') + ); return client.webAuth(url); - } + } /// Sends the user an SMS with a secret key for creating a session. If the /// provided user ID has not be registered, a new user will be created. Use the @@ -1049,28 +1166,30 @@ class Account extends Service { /// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. The secret sent to the user's phone /// is valid for 15 minutes. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - Future createPhoneToken( - {required String userId, required String phone}) async { - final String apiPath = '/account/tokens/phone'; + Future createPhoneToken({required String userId, required String phone}) async { + final String apiPath = '/account/tokens/phone'; final Map apiParams = { + 'userId': userId, - 'phone': phone, +'phone': phone, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to send a verification message to your user email address /// to confirm they are the valid owners of that address. Both the **userId** @@ -1081,28 +1200,31 @@ class Account extends Service { /// parameters. Learn more about how to [complete the verification /// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). /// The verification link sent to the user's email address is valid for 7 days. - /// + /// /// Please note that in order to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - /// - Future createEmailVerification({required String url}) async { - final String apiPath = '/account/verifications/email'; + /// + Future createEmailVerification({required String url}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { + 'url': url, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to send a verification message to your user email address /// to confirm they are the valid owners of that address. Both the **userId** @@ -1113,78 +1235,83 @@ class Account extends Service { /// parameters. Learn more about how to [complete the verification /// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). /// The verification link sent to the user's email address is valid for 7 days. - /// + /// /// Please note that in order to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.') - Future createVerification({required String url}) async { - final String apiPath = '/account/verifications/email'; + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.') + Future createVerification({required String url}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { + 'url': url, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to complete the user email verification process. Use both /// the **userId** and **secret** parameters that were attached to your app URL /// to verify the user email ownership. If confirmed this route will return a /// 200 status code. - Future updateEmailVerification( - {required String userId, required String secret}) async { - final String apiPath = '/account/verifications/email'; + Future updateEmailVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to complete the user email verification process. Use both /// the **userId** and **secret** parameters that were attached to your app URL /// to verify the user email ownership. If confirmed this route will return a /// 200 status code. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.') - Future updateVerification( - {required String userId, required String secret}) async { - final String apiPath = '/account/verifications/email'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.') + Future updateVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to send a verification SMS to the currently logged in /// user. This endpoint is meant for use after updating a user's phone number @@ -1194,41 +1321,47 @@ class Account extends Service { /// process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). /// The verification code sent to the user's phone number is valid for 15 /// minutes. - Future createPhoneVerification() async { - final String apiPath = '/account/verifications/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verifications/phone'; - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Use this endpoint to complete the user phone verification process. Use the /// **userId** and **secret** that were sent to your user's phone number to /// verify the user email ownership. If confirmed this route will return a 200 /// status code. - Future updatePhoneVerification( - {required String userId, required String secret}) async { - final String apiPath = '/account/verifications/phone'; + Future updatePhoneVerification({required String userId, required String secret}) async { + final String apiPath = '/account/verifications/phone'; final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } } diff --git a/lib/services/activities.dart b/lib/services/activities.dart index 90d6f639..304d8166 100644 --- a/lib/services/activities.dart +++ b/lib/services/activities.dart @@ -1,37 +1,45 @@ part of '../dart_appwrite.dart'; class Activities extends Service { - Activities(super.client); + Activities(super.client); /// List all events for selected filters. - Future listEvents({String? queries}) async { - final String apiPath = '/activities/events'; + Future listEvents({String? queries}) async { + final String apiPath = '/activities/events'; final Map apiParams = { if (queries != null) 'queries': queries, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ActivityEventList.fromMap(res.data); - } + + } /// Get event by ID. - /// - Future getEvent({required String eventId}) async { - final String apiPath = - '/activities/events/{eventId}'.replaceAll('{eventId}', eventId); + /// + Future getEvent({required String eventId}) async { + final String apiPath = '/activities/events/{eventId}'.replaceAll('{eventId}', eventId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ActivityEvent.fromMap(res.data); - } + + } } diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index ee09c4bf..7f69beb1 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,261 +1,233 @@ part of '../dart_appwrite.dart'; -/// The Avatars service aims to help you complete everyday tasks related to -/// your app image, icons, and avatars. + /// The Avatars service aims to help you complete everyday tasks related to + /// your app image, icons, and avatars. class Avatars extends Service { - Avatars(super.client); + Avatars(super.client); /// You can use this endpoint to show different browser icons to your users. /// The code argument receives the browser code as it appears in your user [GET /// /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) /// endpoint. Use width, height and quality arguments to change the output /// settings. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - Future getBrowser( - {required enums.Browser code, - int? width, - int? height, - int? quality}) async { - final String apiPath = - '/avatars/browsers/{code}'.replaceAll('{code}', code.value); + Future getBrowser({required enums.Browser code, int? width, int? height, int? quality}) async { + final String apiPath = '/avatars/browsers/{code}'.replaceAll('{code}', code.value); final Map params = { if (width != null) 'width': width, - if (height != null) 'height': height, - if (quality != null) 'quality': quality, +if (height != null) 'height': height, +if (quality != null) 'quality': quality, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// The credit card endpoint will return you the icon of the credit card /// provider you need. Use width, height and quality arguments to change the /// output settings. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// - Future getCreditCard( - {required enums.CreditCard code, - int? width, - int? height, - int? quality}) async { - final String apiPath = - '/avatars/credit-cards/{code}'.replaceAll('{code}', code.value); + /// + Future getCreditCard({required enums.CreditCard code, int? width, int? height, int? quality}) async { + final String apiPath = '/avatars/credit-cards/{code}'.replaceAll('{code}', code.value); final Map params = { if (width != null) 'width': width, - if (height != null) 'height': height, - if (quality != null) 'quality': quality, +if (height != null) 'height': height, +if (quality != null) 'quality': quality, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote /// website URL. - /// + /// /// This endpoint does not follow HTTP redirects. - Future getFavicon({required String url}) async { - final String apiPath = '/avatars/favicon'; + Future getFavicon({required String url}) async { + final String apiPath = '/avatars/favicon'; final Map params = { 'url': url, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// You can use this endpoint to show different country flags icons to your /// users. The code argument receives the 2 letter country code. Use width, /// height and quality arguments to change the output settings. Country codes /// follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// - Future getFlag( - {required enums.Flag code, int? width, int? height, int? quality}) async { - final String apiPath = - '/avatars/flags/{code}'.replaceAll('{code}', code.value); + /// + Future getFlag({required enums.Flag code, int? width, int? height, int? quality}) async { + final String apiPath = '/avatars/flags/{code}'.replaceAll('{code}', code.value); final Map params = { if (width != null) 'width': width, - if (height != null) 'height': height, - if (quality != null) 'quality': quality, +if (height != null) 'height': height, +if (quality != null) 'quality': quality, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to fetch a remote image URL and crop it to any image size /// you want. This endpoint is very useful if you need to crop and display /// remote images in your app or in case you want to make sure a 3rd party /// image is properly served using a TLS protocol. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 400x400px. - /// + /// /// This endpoint does not follow HTTP redirects. - Future getImage( - {required String url, int? width, int? height}) async { - final String apiPath = '/avatars/image'; + Future getImage({required String url, int? width, int? height}) async { + final String apiPath = '/avatars/image'; final Map params = { 'url': url, - if (width != null) 'width': width, - if (height != null) 'height': height, +if (width != null) 'width': width, +if (height != null) 'height': height, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to show your user initials avatar icon on your website or /// app. By default, this route will try to print your logged-in user name or /// email initials. You can also overwrite the user name if you pass the 'name' /// parameter. If no name is given and no user is logged, an empty avatar will /// be returned. - /// + /// /// You can use the color and background params to change the avatar colors. By /// default, a random theme will be selected. The random theme will persist for /// the user's initials when reloading the same theme will always return for /// the same initials. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// - Future getInitials( - {String? name, int? width, int? height, String? background}) async { - final String apiPath = '/avatars/initials'; + /// + Future getInitials({String? name, int? width, int? height, String? background}) async { + final String apiPath = '/avatars/initials'; final Map params = { if (name != null) 'name': name, - if (width != null) 'width': width, - if (height != null) 'height': height, - if (background != null) 'background': background, +if (width != null) 'width': width, +if (height != null) 'height': height, +if (background != null) 'background': background, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Converts a given plain text to a QR code image. You can use the query /// parameters to change the size and style of the resulting image. - /// - Future getQR( - {required String text, int? size, int? margin, bool? download}) async { - final String apiPath = '/avatars/qr'; + /// + Future getQR({required String text, int? size, int? margin, bool? download}) async { + final String apiPath = '/avatars/qr'; final Map params = { 'text': text, - if (size != null) 'size': size, - if (margin != null) 'margin': margin, - if (download != null) 'download': download, +if (size != null) 'size': size, +if (margin != null) 'margin': margin, +if (download != null) 'download': download, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to capture a screenshot of any website URL. This endpoint /// uses a headless browser to render the webpage and capture it as an image. - /// + /// /// You can configure the browser viewport size, theme, user agent, /// geolocation, permissions, and more. Capture either just the viewport or the /// full page scroll. - /// + /// /// When width and height are specified, the image is resized accordingly. If /// both dimensions are 0, the API provides an image at original size. If /// dimensions are not specified, the default viewport size is 1280x720px. - Future getScreenshot( - {required String url, - Map? headers, - int? viewportWidth, - int? viewportHeight, - double? scale, - enums.Theme? theme, - String? userAgent, - bool? fullpage, - String? locale, - enums.Timezone? timezone, - double? latitude, - double? longitude, - double? accuracy, - bool? touch, - List? permissions, - int? sleep, - int? width, - int? height, - int? quality, - enums.ImageFormat? output}) async { - final String apiPath = '/avatars/screenshots'; + Future getScreenshot({required String url, Map? headers, int? viewportWidth, int? viewportHeight, double? scale, enums.Theme? theme, String? userAgent, bool? fullpage, String? locale, enums.Timezone? timezone, double? latitude, double? longitude, double? accuracy, bool? touch, List? permissions, int? sleep, int? width, int? height, int? quality, enums.ImageFormat? output}) async { + final String apiPath = '/avatars/screenshots'; final Map params = { 'url': url, - if (headers != null) 'headers': headers, - if (viewportWidth != null) 'viewportWidth': viewportWidth, - if (viewportHeight != null) 'viewportHeight': viewportHeight, - if (scale != null) 'scale': scale, - if (theme != null) 'theme': theme.value, - if (userAgent != null) 'userAgent': userAgent, - if (fullpage != null) 'fullpage': fullpage, - if (locale != null) 'locale': locale, - if (timezone != null) 'timezone': timezone.value, - if (latitude != null) 'latitude': latitude, - if (longitude != null) 'longitude': longitude, - if (accuracy != null) 'accuracy': accuracy, - if (touch != null) 'touch': touch, - if (permissions != null) - 'permissions': permissions.map((e) => e.value).toList(), - if (sleep != null) 'sleep': sleep, - if (width != null) 'width': width, - if (height != null) 'height': height, - if (quality != null) 'quality': quality, - if (output != null) 'output': output.value, +if (headers != null) 'headers': headers, +if (viewportWidth != null) 'viewportWidth': viewportWidth, +if (viewportHeight != null) 'viewportHeight': viewportHeight, +if (scale != null) 'scale': scale, +if (theme != null) 'theme': theme.value, +if (userAgent != null) 'userAgent': userAgent, +if (fullpage != null) 'fullpage': fullpage, +if (locale != null) 'locale': locale, +if (timezone != null) 'timezone': timezone.value, +if (latitude != null) 'latitude': latitude, +if (longitude != null) 'longitude': longitude, +if (accuracy != null) 'accuracy': accuracy, +if (touch != null) 'touch': touch, +if (permissions != null) 'permissions': permissions.map((e) => e.value).toList(), +if (sleep != null) 'sleep': sleep, +if (width != null) 'width': width, +if (height != null) 'height': height, +if (quality != null) 'quality': quality, +if (output != null) 'output': output.value, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } } diff --git a/lib/services/backups.dart b/lib/services/backups.dart index ba1e2dd9..adcd61e2 100644 --- a/lib/services/backups.dart +++ b/lib/services/backups.dart @@ -1,238 +1,259 @@ part of '../dart_appwrite.dart'; class Backups extends Service { - Backups(super.client); + Backups(super.client); /// List all archives for a project. - Future listArchives({List? queries}) async { - final String apiPath = '/backups/archives'; + Future listArchives({List? queries}) async { + final String apiPath = '/backups/archives'; final Map apiParams = { if (queries != null) 'queries': queries, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupArchiveList.fromMap(res.data); - } + + } /// Create a new archive asynchronously for a project. - Future createArchive( - {required List services, - String? resourceId}) async { - final String apiPath = '/backups/archives'; + Future createArchive({required List services, String? resourceId}) async { + final String apiPath = '/backups/archives'; final Map apiParams = { + 'services': services.map((e) => e.value).toList(), - 'resourceId': resourceId, +'resourceId': resourceId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupArchive.fromMap(res.data); - } + + } /// Get a backup archive using it's ID. - Future getArchive({required String archiveId}) async { - final String apiPath = - '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); + Future getArchive({required String archiveId}) async { + final String apiPath = '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupArchive.fromMap(res.data); - } + + } /// Delete an existing archive for a project. - Future deleteArchive({required String archiveId}) async { - final String apiPath = - '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); + Future deleteArchive({required String archiveId}) async { + final String apiPath = '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// List all policies for a project. - Future listPolicies({List? queries}) async { - final String apiPath = '/backups/policies'; + Future listPolicies({List? queries}) async { + final String apiPath = '/backups/policies'; final Map apiParams = { if (queries != null) 'queries': queries, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicyList.fromMap(res.data); - } + + } /// Create a new backup policy. - Future createPolicy( - {required String policyId, - required List services, - required int retention, - required String schedule, - String? name, - String? resourceId, - bool? enabled}) async { - final String apiPath = '/backups/policies'; + Future createPolicy({required String policyId, required List services, required int retention, required String schedule, String? name, String? resourceId, bool? enabled}) async { + final String apiPath = '/backups/policies'; final Map apiParams = { + 'policyId': policyId, - if (name != null) 'name': name, - 'services': services.map((e) => e.value).toList(), - 'resourceId': resourceId, - if (enabled != null) 'enabled': enabled, - 'retention': retention, - 'schedule': schedule, +if (name != null) 'name': name, +'services': services.map((e) => e.value).toList(), +'resourceId': resourceId, +if (enabled != null) 'enabled': enabled, +'retention': retention, +'schedule': schedule, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicy.fromMap(res.data); - } + + } /// Get a backup policy using it's ID. - Future getPolicy({required String policyId}) async { - final String apiPath = - '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); + Future getPolicy({required String policyId}) async { + final String apiPath = '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicy.fromMap(res.data); - } + + } /// Update an existing policy using it's ID. - Future updatePolicy( - {required String policyId, - String? name, - int? retention, - String? schedule, - bool? enabled}) async { - final String apiPath = - '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); + Future updatePolicy({required String policyId, String? name, int? retention, String? schedule, bool? enabled}) async { + final String apiPath = '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); final Map apiParams = { + 'name': name, - 'retention': retention, - if (schedule != null) 'schedule': schedule, - 'enabled': enabled, +'retention': retention, +if (schedule != null) 'schedule': schedule, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicy.fromMap(res.data); - } + + } /// Delete a policy using it's ID. - Future deletePolicy({required String policyId}) async { - final String apiPath = - '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); + Future deletePolicy({required String policyId}) async { + final String apiPath = '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Create and trigger a new restoration for a backup on a project. - Future createRestoration( - {required String archiveId, - required List services, - String? newResourceId, - String? newResourceName}) async { - final String apiPath = '/backups/restoration'; + Future createRestoration({required String archiveId, required List services, String? newResourceId, String? newResourceName}) async { + final String apiPath = '/backups/restoration'; final Map apiParams = { + 'archiveId': archiveId, - 'services': services.map((e) => e.value).toList(), - if (newResourceId != null) 'newResourceId': newResourceId, - if (newResourceName != null) 'newResourceName': newResourceName, +'services': services.map((e) => e.value).toList(), +if (newResourceId != null) 'newResourceId': newResourceId, +if (newResourceName != null) 'newResourceName': newResourceName, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupRestoration.fromMap(res.data); - } + + } /// List all backup restorations for a project. - Future listRestorations( - {List? queries}) async { - final String apiPath = '/backups/restorations'; + Future listRestorations({List? queries}) async { + final String apiPath = '/backups/restorations'; final Map apiParams = { if (queries != null) 'queries': queries, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupRestorationList.fromMap(res.data); - } + + } /// Get the current status of a backup restoration. - Future getRestoration( - {required String restorationId}) async { - final String apiPath = '/backups/restorations/{restorationId}' - .replaceAll('{restorationId}', restorationId); + Future getRestoration({required String restorationId}) async { + final String apiPath = '/backups/restorations/{restorationId}'.replaceAll('{restorationId}', restorationId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupRestoration.fromMap(res.data); - } + + } } diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 76d6aa73..37c287c9 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1567 +1,1358 @@ part of '../dart_appwrite.dart'; -/// The Databases service allows you to create structured collections of -/// documents, query and filter lists of documents + /// The Databases service allows you to create structured collections of + /// documents, query and filter lists of documents class Databases extends Service { - Databases(super.client); + Databases(super.client); /// Get a list of all databases from the current Appwrite project. You can use /// the search parameter to filter your results. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead.') - Future list( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/databases'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead.') + Future list({List? queries, String? search, bool? total}) async { + final String apiPath = '/databases'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.DatabaseList.fromMap(res.data); - } + + } /// Create a new Database. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead.') - Future create( - {required String databaseId, required String name, bool? enabled}) async { - final String apiPath = '/databases'; + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead.') + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - if (enabled != null) 'enabled': enabled, +'name': name, +if (enabled != null) 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - } + + } /// List transactions across all databases. - Future listTransactions( - {List? queries}) async { - final String apiPath = '/databases/transactions'; + Future listTransactions({List? queries}) async { + final String apiPath = '/databases/transactions'; final Map apiParams = { if (queries != null) 'queries': queries, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TransactionList.fromMap(res.data); - } + + } /// Create a new transaction. - Future createTransaction({int? ttl}) async { - final String apiPath = '/databases/transactions'; + Future createTransaction({int? ttl}) async { + final String apiPath = '/databases/transactions'; final Map apiParams = { + if (ttl != null) 'ttl': ttl, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Get a transaction by its unique ID. - Future getTransaction( - {required String transactionId}) async { - final String apiPath = '/databases/transactions/{transactionId}' - .replaceAll('{transactionId}', transactionId); + Future getTransaction({required String transactionId}) async { + final String apiPath = '/databases/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Update a transaction, to either commit or roll back its operations. - Future updateTransaction( - {required String transactionId, bool? commit, bool? rollback}) async { - final String apiPath = '/databases/transactions/{transactionId}' - .replaceAll('{transactionId}', transactionId); + Future updateTransaction({required String transactionId, bool? commit, bool? rollback}) async { + final String apiPath = '/databases/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); final Map apiParams = { + if (commit != null) 'commit': commit, - if (rollback != null) 'rollback': rollback, +if (rollback != null) 'rollback': rollback, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Delete a transaction by its unique ID. - Future deleteTransaction({required String transactionId}) async { - final String apiPath = '/databases/transactions/{transactionId}' - .replaceAll('{transactionId}', transactionId); + Future deleteTransaction({required String transactionId}) async { + final String apiPath = '/databases/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Create multiple operations in a single transaction. - Future createOperations( - {required String transactionId, List? operations}) async { - final String apiPath = '/databases/transactions/{transactionId}/operations' - .replaceAll('{transactionId}', transactionId); + Future createOperations({required String transactionId, List? operations}) async { + final String apiPath = '/databases/transactions/{transactionId}/operations'.replaceAll('{transactionId}', transactionId); final Map apiParams = { + if (operations != null) 'operations': operations, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Get a database by its unique ID. This endpoint response returns a JSON /// object with the database metadata. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead.') - Future get({required String databaseId}) async { - final String apiPath = - '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead.') + Future get({required String databaseId}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - } + + } /// Update a database by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') - Future update( - {required String databaseId, String? name, bool? enabled}) async { - final String apiPath = - '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update({required String databaseId, String? name, bool? enabled}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + if (name != null) 'name': name, - if (enabled != null) 'enabled': enabled, +if (enabled != null) 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - } + + } /// Delete a database by its unique ID. Only API keys with with databases.write /// scope can delete a database. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead.') - Future delete({required String databaseId}) async { - final String apiPath = - '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead.') + Future delete({required String databaseId}) async { + final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all collections that belong to the provided databaseId. You /// can use the search parameter to filter your results. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead.') - Future listCollections( - {required String databaseId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = '/databases/{databaseId}/collections' - .replaceAll('{databaseId}', databaseId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead.') + Future listCollections({required String databaseId, List? queries, String? search, bool? total}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.CollectionList.fromMap(res.data); - } + + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead.') - Future createCollection( - {required String databaseId, - required String collectionId, - required String name, - List? permissions, - bool? documentSecurity, - bool? enabled, - List? attributes, - List? indexes}) async { - final String apiPath = '/databases/{databaseId}/collections' - .replaceAll('{databaseId}', databaseId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead.') + Future createCollection({required String databaseId, required String collectionId, required String name, List? permissions, bool? documentSecurity, bool? enabled, List? attributes, List? indexes}) async { + final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'collectionId': collectionId, - 'name': name, - 'permissions': permissions, - if (documentSecurity != null) 'documentSecurity': documentSecurity, - if (enabled != null) 'enabled': enabled, - if (attributes != null) 'attributes': attributes, - if (indexes != null) 'indexes': indexes, +'name': name, +'permissions': permissions, +if (documentSecurity != null) 'documentSecurity': documentSecurity, +if (enabled != null) 'enabled': enabled, +if (attributes != null) 'attributes': attributes, +if (indexes != null) 'indexes': indexes, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Collection.fromMap(res.data); - } + + } /// Get a collection by its unique ID. This endpoint response returns a JSON /// object with the collection metadata. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead.') - Future getCollection( - {required String databaseId, required String collectionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead.') + Future getCollection({required String databaseId, required String collectionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Collection.fromMap(res.data); - } + + } /// Update a collection by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead.') - Future updateCollection( - {required String databaseId, - required String collectionId, - String? name, - List? permissions, - bool? documentSecurity, - bool? enabled, - bool? purge}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead.') + Future updateCollection({required String databaseId, required String collectionId, String? name, List? permissions, bool? documentSecurity, bool? enabled, bool? purge}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + if (name != null) 'name': name, - 'permissions': permissions, - if (documentSecurity != null) 'documentSecurity': documentSecurity, - if (enabled != null) 'enabled': enabled, - if (purge != null) 'purge': purge, +'permissions': permissions, +if (documentSecurity != null) 'documentSecurity': documentSecurity, +if (enabled != null) 'enabled': enabled, +if (purge != null) 'purge': purge, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Collection.fromMap(res.data); - } + + } /// Delete a collection by its unique ID. Only users with write permissions /// have access to delete this resource. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead.') - Future deleteCollection( - {required String databaseId, required String collectionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead.') + Future deleteCollection({required String databaseId, required String collectionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// List attributes in the collection. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead.') - Future listAttributes( - {required String databaseId, - required String collectionId, - List? queries, - bool? total}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead.') + Future listAttributes({required String databaseId, required String collectionId, List? queries, bool? total}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeList.fromMap(res.data); - } - /// Create a boolean attribute. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead.') - Future createBooleanAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - bool? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + } + + /// Create a bigint attribute. Optionally, minimum and maximum values can be + /// provided. + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead.') + Future createBigIntAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +if (array != null) 'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.AttributeBigint.fromMap(res.data); + + } + + /// Update a bigint attribute. Changing the `default` value will not update + /// already existing documents. + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead.') + Future updateBigIntAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + + final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'min': min, +'max': max, +'default': xdefault, +'newKey': newKey, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.AttributeBigint.fromMap(res.data); + + } + + /// Create a boolean attribute. + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead.') + Future createBooleanAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, bool? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeBoolean.fromMap(res.data); - } + + } /// Update a boolean attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead.') - Future updateBooleanAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required bool? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead.') + Future updateBooleanAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required bool? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeBoolean.fromMap(res.data); - } + + } /// Create a date time attribute according to the ISO 8601 standard. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead.') - Future createDatetimeAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead.') + Future createDatetimeAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeDatetime.fromMap(res.data); - } + + } /// Update a date time attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead.') - Future updateDatetimeAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead.') + Future updateDatetimeAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeDatetime.fromMap(res.data); - } + + } /// Create an email attribute. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead.') - Future createEmailAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/email' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead.') + Future createEmailAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEmail.fromMap(res.data); - } + + } /// Update an email attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead.') - Future updateEmailAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead.') + Future updateEmailAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEmail.fromMap(res.data); - } + + } /// Create an enum attribute. The `elements` param acts as a white-list of - /// accepted values for this attribute. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead.') - Future createEnumAttribute( - {required String databaseId, - required String collectionId, - required String key, - required List elements, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/enum' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// accepted values for this attribute. + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead.') + Future createEnumAttribute({required String databaseId, required String collectionId, required String key, required List elements, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'elements': elements, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEnum.fromMap(res.data); - } + + } /// Update an enum attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead.') - Future updateEnumAttribute( - {required String databaseId, - required String collectionId, - required String key, - required List elements, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead.') + Future updateEnumAttribute({required String databaseId, required String collectionId, required String key, required List elements, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'elements': elements, - 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'required': xrequired, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEnum.fromMap(res.data); - } + + } /// Create a float attribute. Optionally, minimum and maximum values can be /// provided. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead.') - Future createFloatAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - double? min, - double? max, - double? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/float' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead.') + Future createFloatAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, double? min, double? max, double? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeFloat.fromMap(res.data); - } + + } /// Update a float attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead.') - Future updateFloatAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required double? xdefault, - double? min, - double? max, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead.') + Future updateFloatAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required double? xdefault, double? min, double? max, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - 'newKey': newKey, +'min': min, +'max': max, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeFloat.fromMap(res.data); - } + + } /// Create an integer attribute. Optionally, minimum and maximum values can be /// provided. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead.') - Future createIntegerAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - int? min, - int? max, - int? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/integer' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead.') + Future createIntegerAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeInteger.fromMap(res.data); - } + + } /// Update an integer attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead.') - Future updateIntegerAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required int? xdefault, - int? min, - int? max, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead.') + Future updateIntegerAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - 'newKey': newKey, +'min': min, +'max': max, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeInteger.fromMap(res.data); - } + + } /// Create IP address attribute. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead.') - Future createIpAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/ip' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead.') + Future createIpAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeIp.fromMap(res.data); - } + + } /// Update an ip attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead.') - Future updateIpAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead.') + Future updateIpAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeIp.fromMap(res.data); - } + + } /// Create a geometric line attribute. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead.') - Future createLineAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - List? xdefault}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/line' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead.') + Future createLineAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, +'required': xrequired, +'default': xdefault, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLine.fromMap(res.data); - } + + } /// Update a line attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead.') - Future updateLineAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - List? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead.') + Future updateLineAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLine.fromMap(res.data); - } + + } /// Create a longtext attribute. - /// - Future createLongtextAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/longtext' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + Future createLongtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLongtext.fromMap(res.data); - } + + } /// Update a longtext attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateLongtextAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + Future updateLongtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLongtext.fromMap(res.data); - } + + } /// Create a mediumtext attribute. - /// - Future createMediumtextAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + Future createMediumtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeMediumtext.fromMap(res.data); - } + + } /// Update a mediumtext attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateMediumtextAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + Future updateMediumtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeMediumtext.fromMap(res.data); - } + + } /// Create a geometric point attribute. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.') - Future createPointAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - List? xdefault}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/point' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.') + Future createPointAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, +'required': xrequired, +'default': xdefault, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePoint.fromMap(res.data); - } + + } /// Update a point attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead.') - Future updatePointAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - List? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead.') + Future updatePointAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePoint.fromMap(res.data); - } + + } /// Create a geometric polygon attribute. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead.') - Future createPolygonAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - List? xdefault}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead.') + Future createPolygonAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, +'required': xrequired, +'default': xdefault, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePolygon.fromMap(res.data); - } + + } /// Update a polygon attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead.') - Future updatePolygonAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - List? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead.') + Future updatePolygonAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePolygon.fromMap(res.data); - } + + } /// Create relationship attribute. [Learn more about relationship /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead.') - Future createRelationshipAttribute( - {required String databaseId, - required String collectionId, - required String relatedCollectionId, - required enums.RelationshipType type, - bool? twoWay, - String? key, - String? twoWayKey, - enums.RelationMutate? onDelete}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead.') + Future createRelationshipAttribute({required String databaseId, required String collectionId, required String relatedCollectionId, required enums.RelationshipType type, bool? twoWay, String? key, String? twoWayKey, enums.RelationMutate? onDelete}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'relatedCollectionId': relatedCollectionId, - 'type': type.value, - if (twoWay != null) 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - if (onDelete != null) 'onDelete': onDelete.value, +'type': type.value, +if (twoWay != null) 'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +if (onDelete != null) 'onDelete': onDelete.value, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeRelationship.fromMap(res.data); - } + + } /// Update relationship attribute. [Learn more about relationship /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.') - Future updateRelationshipAttribute( - {required String databaseId, - required String collectionId, - required String key, - enums.RelationMutate? onDelete, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.') + Future updateRelationshipAttribute({required String databaseId, required String collectionId, required String key, enums.RelationMutate? onDelete, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + if (onDelete != null) 'onDelete': onDelete.value, - 'newKey': newKey, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeRelationship.fromMap(res.data); - } + + } /// Create a string attribute. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead.') - Future createStringAttribute( - {required String databaseId, - required String collectionId, - required String key, - required int size, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/string' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead.') + Future createStringAttribute({required String databaseId, required String collectionId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'size': size, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeString.fromMap(res.data); - } + + } /// Update a string attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead.') - Future updateStringAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - int? size, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead.') + Future updateStringAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'size': size, - 'newKey': newKey, +'default': xdefault, +'size': size, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeString.fromMap(res.data); - } + + } /// Create a text attribute. - /// - Future createTextAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/text' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + Future createTextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeText.fromMap(res.data); - } + + } /// Update a text attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateTextAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + Future updateTextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeText.fromMap(res.data); - } + + } /// Create a URL attribute. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead.') - Future createUrlAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/url' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead.') + Future createUrlAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeUrl.fromMap(res.data); - } + + } /// Update an url attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead.') - Future updateUrlAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead.') + Future updateUrlAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeUrl.fromMap(res.data); - } + + } /// Create a varchar attribute. - /// - Future createVarcharAttribute( - {required String databaseId, - required String collectionId, - required String key, - required int size, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + Future createVarcharAttribute({required String databaseId, required String collectionId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'size': size, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeVarchar.fromMap(res.data); - } + + } /// Update a varchar attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateVarcharAttribute( - {required String databaseId, - required String collectionId, - required String key, - required bool xrequired, - required String? xdefault, - int? size, - String? newKey}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + /// + Future updateVarcharAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'size': size, - 'newKey': newKey, +'default': xdefault, +'size': size, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeVarchar.fromMap(res.data); - } + + } /// Get attribute by ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead.') - Future getAttribute( - {required String databaseId, - required String collectionId, - required String key}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead.') + Future getAttribute({required String databaseId, required String collectionId, required String key}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError( - 'Unable to match response to any expected response model.'); + throw StateError('Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -1596,526 +1387,421 @@ class Databases extends Service { return models.AttributeString.fromMap(response); } - throw StateError( - 'Unable to match response to any expected response model.'); + throw StateError('Unable to match response to any expected response model.'); }(); - } + + } /// Deletes an attribute. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead.') - Future deleteAttribute( - {required String databaseId, - required String collectionId, - required String key}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead.') + Future deleteAttribute({required String databaseId, required String collectionId, required String key}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all the user's documents in a given collection. You can use /// the query params to filter your results. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.') - Future listDocuments( - {required String databaseId, - required String collectionId, - List? queries, - String? transactionId, - bool? total, - int? ttl}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.') + Future listDocuments({required String databaseId, required String collectionId, List? queries, String? transactionId, bool? total, int? ttl}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { if (queries != null) 'queries': queries, - if (transactionId != null) 'transactionId': transactionId, - if (total != null) 'total': total, - if (ttl != null) 'ttl': ttl, +if (transactionId != null) 'transactionId': transactionId, +if (total != null) 'total': total, +if (ttl != null) 'ttl': ttl, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - } + + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead.') - Future createDocument( - {required String databaseId, - required String collectionId, - required String documentId, - required Map data, - List? permissions, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead.') + Future createDocument({required String databaseId, required String collectionId, required String documentId, required Map data, List? permissions, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documentId': documentId, - 'data': data, - 'permissions': permissions, - 'transactionId': transactionId, +'data': data, +'permissions': permissions, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - } + + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead.') - Future createDocuments( - {required String databaseId, - required String collectionId, - required List documents, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead.') + Future createDocuments({required String databaseId, required String collectionId, required List documents, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documents': documents, - 'transactionId': transactionId, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - } + + } /// 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#databasesCreateCollection) /// API or directly from your database console. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.') - Future upsertDocuments( - {required String databaseId, - required String collectionId, - required List documents, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.') + Future upsertDocuments({required String databaseId, required String collectionId, required List documents, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'documents': documents, - 'transactionId': transactionId, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - } + + } /// 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. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead.') - Future updateDocuments( - {required String databaseId, - required String collectionId, - Map? data, - List? queries, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead.') + Future updateDocuments({required String databaseId, required String collectionId, Map? data, List? queries, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + if (data != null) 'data': data, - if (queries != null) 'queries': queries, - 'transactionId': transactionId, +if (queries != null) 'queries': queries, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - } + + } /// Bulk delete documents using queries, if no queries are passed then all /// documents are deleted. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead.') - Future deleteDocuments( - {required String databaseId, - required String collectionId, - List? queries, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead.') + Future deleteDocuments({required String databaseId, required String collectionId, List? queries, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + if (queries != null) 'queries': queries, - 'transactionId': transactionId, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - } + + } /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead.') - Future getDocument( - {required String databaseId, - required String collectionId, - required String documentId, - List? queries, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead.') + Future getDocument({required String databaseId, required String collectionId, required String documentId, List? queries, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { if (queries != null) 'queries': queries, - if (transactionId != null) 'transactionId': transactionId, +if (transactionId != null) 'transactionId': transactionId, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - } + + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.') - Future upsertDocument( - {required String databaseId, - required String collectionId, - required String documentId, - Map? data, - List? permissions, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.') + Future upsertDocument({required String databaseId, required String collectionId, required String documentId, Map? data, List? permissions, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + if (data != null) 'data': data, - 'permissions': permissions, - 'transactionId': transactionId, +'permissions': permissions, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - } + + } /// Update a document by its unique ID. Using the patch method you can pass /// only specific fields that will get updated. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead.') - Future updateDocument( - {required String databaseId, - required String collectionId, - required String documentId, - Map? data, - List? permissions, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead.') + Future updateDocument({required String databaseId, required String collectionId, required String documentId, Map? data, List? permissions, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + if (data != null) 'data': data, - 'permissions': permissions, - 'transactionId': transactionId, +'permissions': permissions, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - } + + } /// Delete a document by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead.') - Future deleteDocument( - {required String databaseId, - required String collectionId, - required String documentId, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead.') + Future deleteDocument({required String databaseId, required String collectionId, required String documentId, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); final Map apiParams = { + 'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Decrement a specific attribute of a document by a given value. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead.') - Future decrementDocumentAttribute( - {required String databaseId, - required String collectionId, - required String documentId, - required String attribute, - double? value, - double? min, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId) - .replaceAll('{attribute}', attribute); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead.') + Future decrementDocumentAttribute({required String databaseId, required String collectionId, required String documentId, required String attribute, double? value, double? min, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId).replaceAll('{attribute}', attribute); final Map apiParams = { + if (value != null) 'value': value, - 'min': min, - 'transactionId': transactionId, +'min': min, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - } + + } /// Increment a specific attribute of a document by a given value. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead.') - Future incrementDocumentAttribute( - {required String databaseId, - required String collectionId, - required String documentId, - required String attribute, - double? value, - double? max, - String? transactionId}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{documentId}', documentId) - .replaceAll('{attribute}', attribute); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead.') + Future incrementDocumentAttribute({required String databaseId, required String collectionId, required String documentId, required String attribute, double? value, double? max, String? transactionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId).replaceAll('{attribute}', attribute); final Map apiParams = { + if (value != null) 'value': value, - 'max': max, - 'transactionId': transactionId, +'max': max, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - } + + } /// List indexes in the collection. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead.') - Future listIndexes( - {required String databaseId, - required String collectionId, - List? queries, - bool? total}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead.') + Future listIndexes({required String databaseId, required String collectionId, List? queries, bool? total}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.IndexList.fromMap(res.data); - } + + } /// Creates an index on the attributes listed. Your index should include all /// the attributes you will query in a single request. /// Attributes can be `key`, `fulltext`, and `unique`. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead.') - Future createIndex( - {required String databaseId, - required String collectionId, - required String key, - required enums.DatabasesIndexType type, - required List attributes, - List? orders, - List? lengths}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead.') + Future createIndex({required String databaseId, required String collectionId, required String key, required enums.DatabasesIndexType type, required List attributes, List? orders, List? lengths}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); final Map apiParams = { + 'key': key, - 'type': type.value, - 'attributes': attributes, - if (orders != null) 'orders': orders.map((e) => e.value).toList(), - if (lengths != null) 'lengths': lengths, +'type': type.value, +'attributes': attributes, +if (orders != null) 'orders': orders.map((e) => e.value).toList(), +if (lengths != null) 'lengths': lengths, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Index.fromMap(res.data); - } + + } /// Get an index by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead.') - Future getIndex( - {required String databaseId, - required String collectionId, - required String key}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead.') + Future getIndex({required String databaseId, required String collectionId, required String key}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Index.fromMap(res.data); - } + + } /// Delete an index. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead.') - Future deleteIndex( - {required String databaseId, - required String collectionId, - required String key}) async { - final String apiPath = - '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{collectionId}', collectionId) - .replaceAll('{key}', key); + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead.') + Future deleteIndex({required String databaseId, required String collectionId, required String key}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/functions.dart b/lib/services/functions.dart index e17e0f65..caad5e38 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,288 +1,262 @@ part of '../dart_appwrite.dart'; -/// The Functions Service allows you view, create and manage your Cloud -/// Functions. + /// The Functions Service allows you view, create and manage your Cloud + /// Functions. class Functions extends Service { - Functions(super.client); + Functions(super.client); /// Get a list of all the project's functions. You can use the query params to /// filter your results. - Future list( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/functions'; + Future list({List? queries, String? search, bool? total}) async { + final String apiPath = '/functions'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.FunctionList.fromMap(res.data); - } + + } /// Create a new function. You can pass a list of /// [permissions](https://appwrite.io/docs/permissions) to allow different /// project users or team with access to execute the function using the client /// API. - Future create( - {required String functionId, - required String name, - required enums.Runtime runtime, - List? execute, - List? events, - String? schedule, - int? timeout, - bool? enabled, - bool? logging, - String? entrypoint, - String? commands, - List? scopes, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? buildSpecification, - String? runtimeSpecification, - int? deploymentRetention}) async { - final String apiPath = '/functions'; + Future create({required String functionId, required String name, required enums.Runtime runtime, List? execute, List? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, List? scopes, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { + final String apiPath = '/functions'; final Map apiParams = { + 'functionId': functionId, - 'name': name, - 'runtime': runtime.value, - if (execute != null) 'execute': execute, - if (events != null) 'events': events, - if (schedule != null) 'schedule': schedule, - if (timeout != null) 'timeout': timeout, - if (enabled != null) 'enabled': enabled, - if (logging != null) 'logging': logging, - if (entrypoint != null) 'entrypoint': entrypoint, - if (commands != null) 'commands': commands, - if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), - if (installationId != null) 'installationId': installationId, - if (providerRepositoryId != null) - 'providerRepositoryId': providerRepositoryId, - if (providerBranch != null) 'providerBranch': providerBranch, - if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, - if (providerRootDirectory != null) - 'providerRootDirectory': providerRootDirectory, - if (buildSpecification != null) 'buildSpecification': buildSpecification, - if (runtimeSpecification != null) - 'runtimeSpecification': runtimeSpecification, - if (deploymentRetention != null) - 'deploymentRetention': deploymentRetention, +'name': name, +'runtime': runtime.value, +if (execute != null) 'execute': execute, +if (events != null) 'events': events, +if (schedule != null) 'schedule': schedule, +if (timeout != null) 'timeout': timeout, +if (enabled != null) 'enabled': enabled, +if (logging != null) 'logging': logging, +if (entrypoint != null) 'entrypoint': entrypoint, +if (commands != null) 'commands': commands, +if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), +if (installationId != null) 'installationId': installationId, +if (providerRepositoryId != null) 'providerRepositoryId': providerRepositoryId, +if (providerBranch != null) 'providerBranch': providerBranch, +if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, +if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, +if (buildSpecification != null) 'buildSpecification': buildSpecification, +if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, +if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - } + + } /// Get a list of all runtimes that are currently active on your instance. - Future listRuntimes() async { - final String apiPath = '/functions/runtimes'; + Future listRuntimes() async { + final String apiPath = '/functions/runtimes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.RuntimeList.fromMap(res.data); - } + + } /// List allowed function specifications for this instance. - Future listSpecifications() async { - final String apiPath = '/functions/specifications'; + Future listSpecifications() async { + final String apiPath = '/functions/specifications'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.SpecificationList.fromMap(res.data); - } + + } /// Get a function by its unique ID. - Future get({required String functionId}) async { - final String apiPath = - '/functions/{functionId}'.replaceAll('{functionId}', functionId); + Future get({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - } + + } /// Update function by its unique ID. - Future update( - {required String functionId, - required String name, - enums.Runtime? runtime, - List? execute, - List? events, - String? schedule, - int? timeout, - bool? enabled, - bool? logging, - String? entrypoint, - String? commands, - List? scopes, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? buildSpecification, - String? runtimeSpecification, - int? deploymentRetention}) async { - final String apiPath = - '/functions/{functionId}'.replaceAll('{functionId}', functionId); + Future update({required String functionId, required String name, enums.Runtime? runtime, List? execute, List? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, List? scopes, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'name': name, - if (runtime != null) 'runtime': runtime.value, - if (execute != null) 'execute': execute, - if (events != null) 'events': events, - if (schedule != null) 'schedule': schedule, - if (timeout != null) 'timeout': timeout, - if (enabled != null) 'enabled': enabled, - if (logging != null) 'logging': logging, - if (entrypoint != null) 'entrypoint': entrypoint, - if (commands != null) 'commands': commands, - if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), - if (installationId != null) 'installationId': installationId, - 'providerRepositoryId': providerRepositoryId, - if (providerBranch != null) 'providerBranch': providerBranch, - if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, - if (providerRootDirectory != null) - 'providerRootDirectory': providerRootDirectory, - if (buildSpecification != null) 'buildSpecification': buildSpecification, - if (runtimeSpecification != null) - 'runtimeSpecification': runtimeSpecification, - if (deploymentRetention != null) - 'deploymentRetention': deploymentRetention, +if (runtime != null) 'runtime': runtime.value, +if (execute != null) 'execute': execute, +if (events != null) 'events': events, +if (schedule != null) 'schedule': schedule, +if (timeout != null) 'timeout': timeout, +if (enabled != null) 'enabled': enabled, +if (logging != null) 'logging': logging, +if (entrypoint != null) 'entrypoint': entrypoint, +if (commands != null) 'commands': commands, +if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), +if (installationId != null) 'installationId': installationId, +'providerRepositoryId': providerRepositoryId, +if (providerBranch != null) 'providerBranch': providerBranch, +if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, +if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, +if (buildSpecification != null) 'buildSpecification': buildSpecification, +if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, +if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - } + + } /// Delete a function by its unique ID. - Future delete({required String functionId}) async { - final String apiPath = - '/functions/{functionId}'.replaceAll('{functionId}', functionId); + Future delete({required String functionId}) async { + final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Update the function active deployment. Use this endpoint to switch the code /// deployment that should be used when visitor opens your function. - Future updateFunctionDeployment( - {required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployment' - .replaceAll('{functionId}', functionId); + Future updateFunctionDeployment({required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployment'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'deploymentId': deploymentId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - } + + } /// Get a list of all the function's code deployments. You can use the query /// params to filter your results. - Future listDeployments( - {required String functionId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = '/functions/{functionId}/deployments' - .replaceAll('{functionId}', functionId); + Future listDeployments({required String functionId, List? queries, String? search, bool? total}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.DeploymentList.fromMap(res.data); - } + + } /// Create a new function code deployment. Use this endpoint to upload a new /// version of your code function. To execute your newly uploaded code, you'll /// need to update the function's deployment to use your new deployment UID. - /// + /// /// This endpoint accepts a tar.gz file compressed with your code. Make sure to /// include any dependencies your code has within the compressed file. You can /// learn more about code packaging in the [Appwrite Cloud Functions /// tutorial](https://appwrite.io/docs/functions). - /// + /// /// Use the "command" param to set the entrypoint used to execute your code. - Future createDeployment( - {required String functionId, - required InputFile code, - required bool activate, - String? entrypoint, - String? commands, - Function(UploadProgress)? onProgress}) async { - final String apiPath = '/functions/{functionId}/deployments' - .replaceAll('{functionId}', functionId); + Future createDeployment({required String functionId, required InputFile code, required bool activate, String? entrypoint, String? commands, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); final Map apiParams = { + if (entrypoint != null) 'entrypoint': entrypoint, - if (commands != null) 'commands': commands, - 'code': code, - 'activate': activate, +if (commands != null) 'commands': commands, +'code': code, +'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -297,372 +271,366 @@ class Functions extends Service { ); return models.Deployment.fromMap(res.data); - } + + } /// Create a new build for an existing function deployment. This endpoint /// allows you to rebuild a deployment with the updated function configuration, /// including its entrypoint and build commands if they have been modified. The /// build process will be queued and executed asynchronously. The original /// deployment's code will be preserved and used for the new build. - Future createDuplicateDeployment( - {required String functionId, - required String deploymentId, - String? buildId}) async { - final String apiPath = '/functions/{functionId}/deployments/duplicate' - .replaceAll('{functionId}', functionId); + Future createDuplicateDeployment({required String functionId, required String deploymentId, String? buildId}) async { + final String apiPath = '/functions/{functionId}/deployments/duplicate'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'deploymentId': deploymentId, - if (buildId != null) 'buildId': buildId, +if (buildId != null) 'buildId': buildId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Create a deployment based on a template. - /// + /// /// Use this endpoint with combination of /// [listTemplates](https://appwrite.io/docs/products/functions/templates) to /// find the template details. - Future createTemplateDeployment( - {required String functionId, - required String repository, - required String owner, - required String rootDirectory, - required enums.TemplateReferenceType type, - required String reference, - bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/template' - .replaceAll('{functionId}', functionId); + Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required enums.TemplateReferenceType type, required String reference, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'type': type.value, - 'reference': reference, - if (activate != null) 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'type': type.value, +'reference': reference, +if (activate != null) 'activate': activate, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Create a deployment when a function is connected to VCS. - /// + /// /// This endpoint lets you create deployment from a branch, commit, or a tag. - Future createVcsDeployment( - {required String functionId, - required enums.VCSReferenceType type, - required String reference, - bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs' - .replaceAll('{functionId}', functionId); + Future createVcsDeployment({required String functionId, required enums.VCSReferenceType type, required String reference, bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); final Map apiParams = { + 'type': type.value, - 'reference': reference, - if (activate != null) 'activate': activate, +'reference': reference, +if (activate != null) 'activate': activate, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Get a function deployment by its unique ID. - Future getDeployment( - {required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{deploymentId}', deploymentId); + Future getDeployment({required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Delete a code deployment by its unique ID. - Future deleteDeployment( - {required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{deploymentId}', deploymentId); + Future deleteDeployment({required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a function deployment content by its unique ID. The endpoint response /// return with a 'Content-Disposition: attachment' header that tells the /// browser to start downloading the file to user downloads directory. - Future getDeploymentDownload( - {required String functionId, - required String deploymentId, - enums.DeploymentDownloadType? type}) async { - final String apiPath = - '/functions/{functionId}/deployments/{deploymentId}/download' - .replaceAll('{functionId}', functionId) - .replaceAll('{deploymentId}', deploymentId); + Future getDeploymentDownload({required String functionId, required String deploymentId, enums.DeploymentDownloadType? type}) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); final Map params = { if (type != null) 'type': type.value, + + 'project': client.config['project'], 'key': client.config['key'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Cancel an ongoing function deployment build. If the build is already in /// progress, it will be stopped and marked as canceled. If the build hasn't /// started yet, it will be marked as canceled without executing. You cannot /// cancel builds that have already completed (status 'ready') or failed. The /// response includes the final build status and details. - Future updateDeploymentStatus( - {required String functionId, required String deploymentId}) async { - final String apiPath = - '/functions/{functionId}/deployments/{deploymentId}/status' - .replaceAll('{functionId}', functionId) - .replaceAll('{deploymentId}', deploymentId); + Future updateDeploymentStatus({required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Get a list of all the current user function execution logs. You can use the /// query params to filter your results. - Future listExecutions( - {required String functionId, List? queries, bool? total}) async { - final String apiPath = '/functions/{functionId}/executions' - .replaceAll('{functionId}', functionId); + Future listExecutions({required String functionId, List? queries, bool? total}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ExecutionList.fromMap(res.data); - } + + } /// Trigger a function execution. The returned object will return you the /// current execution status. You can ping the `Get Execution` endpoint to get /// updates on the current execution status. Once this endpoint is called, your /// function execution process will start asynchronously. - Future createExecution( - {required String functionId, - String? body, - bool? xasync, - String? path, - enums.ExecutionMethod? method, - Map? headers, - String? scheduledAt}) async { - final String apiPath = '/functions/{functionId}/executions' - .replaceAll('{functionId}', functionId); + Future createExecution({required String functionId, String? body, bool? xasync, String? path, enums.ExecutionMethod? method, Map? headers, String? scheduledAt}) async { + final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); final Map apiParams = { + if (body != null) 'body': body, - if (xasync != null) 'async': xasync, - if (path != null) 'path': path, - if (method != null) 'method': method.value, - if (headers != null) 'headers': headers, - 'scheduledAt': scheduledAt, +if (xasync != null) 'async': xasync, +if (path != null) 'path': path, +if (method != null) 'method': method.value, +if (headers != null) 'headers': headers, +'scheduledAt': scheduledAt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Execution.fromMap(res.data); - } + + } /// Get a function execution log by its unique ID. - Future getExecution( - {required String functionId, required String executionId}) async { - final String apiPath = '/functions/{functionId}/executions/{executionId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{executionId}', executionId); + Future getExecution({required String functionId, required String executionId}) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}'.replaceAll('{functionId}', functionId).replaceAll('{executionId}', executionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Execution.fromMap(res.data); - } + + } /// Delete a function execution by its unique ID. - Future deleteExecution( - {required String functionId, required String executionId}) async { - final String apiPath = '/functions/{functionId}/executions/{executionId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{executionId}', executionId); + Future deleteExecution({required String functionId, required String executionId}) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}'.replaceAll('{functionId}', functionId).replaceAll('{executionId}', executionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all variables of a specific function. - Future listVariables( - {required String functionId}) async { - final String apiPath = '/functions/{functionId}/variables' - .replaceAll('{functionId}', functionId); + Future listVariables({required String functionId, List? queries, bool? total}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); - final Map apiParams = {}; + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, - final Map apiHeaders = {}; + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.VariableList.fromMap(res.data); - } + + } /// Create a new function environment variable. These variables can be accessed /// in the function at runtime as environment variables. - Future createVariable( - {required String functionId, - required String key, - required String value, - bool? secret}) async { - final String apiPath = '/functions/{functionId}/variables' - .replaceAll('{functionId}', functionId); + Future createVariable({required String functionId, required String variableId, required String key, required String value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); final Map apiParams = { - 'key': key, - 'value': value, - if (secret != null) 'secret': secret, + + 'variableId': variableId, +'key': key, +'value': value, +if (secret != null) 'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Get a variable by its unique ID. - Future getVariable( - {required String functionId, required String variableId}) async { - final String apiPath = '/functions/{functionId}/variables/{variableId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{variableId}', variableId); + Future getVariable({required String functionId, required String variableId}) async { + final String apiPath = '/functions/{functionId}/variables/{variableId}'.replaceAll('{functionId}', functionId).replaceAll('{variableId}', variableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Update variable by its unique ID. - Future updateVariable( - {required String functionId, - required String variableId, - required String key, - String? value, - bool? secret}) async { - final String apiPath = '/functions/{functionId}/variables/{variableId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{variableId}', variableId); + Future updateVariable({required String functionId, required String variableId, String? key, String? value, bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables/{variableId}'.replaceAll('{functionId}', functionId).replaceAll('{variableId}', variableId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Delete a variable by its unique ID. - Future deleteVariable( - {required String functionId, required String variableId}) async { - final String apiPath = '/functions/{functionId}/variables/{variableId}' - .replaceAll('{functionId}', functionId) - .replaceAll('{variableId}', variableId); + Future deleteVariable({required String functionId, required String variableId}) async { + final String apiPath = '/functions/{functionId}/variables/{variableId}'.replaceAll('{functionId}', functionId).replaceAll('{variableId}', variableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index f1275fd4..7dd8a04d 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,45 +1,51 @@ part of '../dart_appwrite.dart'; -/// The GraphQL API allows you to query and mutate your Appwrite server using -/// GraphQL. + /// The GraphQL API allows you to query and mutate your Appwrite server using + /// GraphQL. class Graphql extends Service { - Graphql(super.client); + Graphql(super.client); /// Execute a GraphQL mutation. - Future query({required Map query}) async { - final String apiPath = '/graphql'; + Future query({required Map query}) async { + final String apiPath = '/graphql'; final Map apiParams = { + 'query': query, + }; final Map apiHeaders = { 'x-sdk-graphql': 'true', - 'content-type': 'application/json', +'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Execute a GraphQL mutation. - Future mutation({required Map query}) async { - final String apiPath = '/graphql/mutation'; + Future mutation({required Map query}) async { + final String apiPath = '/graphql/mutation'; final Map apiParams = { + 'query': query, + }; final Map apiHeaders = { 'x-sdk-graphql': 'true', - 'content-type': 'application/json', +'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/health.dart b/lib/services/health.dart index 7e83036f..ed3f7662 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,388 +1,483 @@ part of '../dart_appwrite.dart'; -/// The Health service allows you to both validate and monitor your Appwrite -/// server's health. + /// The Health service allows you to both validate and monitor your Appwrite + /// server's health. class Health extends Service { - Health(super.client); + Health(super.client); /// Check the Appwrite HTTP server is up and responsive. - Future get() async { - final String apiPath = '/health'; + Future get() async { + final String apiPath = '/health'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - } + + } /// Check the Appwrite Antivirus server is up and connection is successful. - Future getAntivirus() async { - final String apiPath = '/health/anti-virus'; + Future getAntivirus() async { + final String apiPath = '/health/anti-virus'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthAntivirus.fromMap(res.data); - } + + } /// Check the Appwrite in-memory cache servers are up and connection is /// successful. - Future getCache() async { - final String apiPath = '/health/cache'; + Future getCache() async { + final String apiPath = '/health/cache'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatusList.fromMap(res.data); - } + + } /// Get the SSL certificate for a domain - Future getCertificate({String? domain}) async { - final String apiPath = '/health/certificate'; + Future getCertificate({String? domain}) async { + final String apiPath = '/health/certificate'; final Map apiParams = { if (domain != null) 'domain': domain, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthCertificate.fromMap(res.data); - } + + } /// Get console pausing health status. Monitors projects approaching the pause /// threshold to detect potential issues with console access tracking. - /// - Future getConsolePausing( - {int? threshold, int? inactivityDays}) async { - final String apiPath = '/health/console-pausing'; + /// + Future getConsolePausing({int? threshold, int? inactivityDays}) async { + final String apiPath = '/health/console-pausing'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - if (inactivityDays != null) 'inactivityDays': inactivityDays, +if (inactivityDays != null) 'inactivityDays': inactivityDays, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - } + + } /// Check the Appwrite database servers are up and connection is successful. - Future getDB() async { - final String apiPath = '/health/db'; + Future getDB() async { + final String apiPath = '/health/db'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatusList.fromMap(res.data); - } + + } /// Check the Appwrite pub-sub servers are up and connection is successful. - Future getPubSub() async { - final String apiPath = '/health/pubsub'; + Future getPubSub() async { + final String apiPath = '/health/pubsub'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatusList.fromMap(res.data); - } + + } /// Get the number of audit logs that are waiting to be processed in the /// Appwrite internal queue server. - /// - Future getQueueAudits({int? threshold}) async { - final String apiPath = '/health/queue/audits'; + /// + Future getQueueAudits({int? threshold}) async { + final String apiPath = '/health/queue/audits'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of builds that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueBuilds({int? threshold}) async { - final String apiPath = '/health/queue/builds'; + Future getQueueBuilds({int? threshold}) async { + final String apiPath = '/health/queue/builds'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of certificates that are waiting to be issued against /// [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue /// server. - Future getQueueCertificates({int? threshold}) async { - final String apiPath = '/health/queue/certificates'; + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of database changes that are waiting to be processed in the /// Appwrite internal queue server. - Future getQueueDatabases( - {String? name, int? threshold}) async { - final String apiPath = '/health/queue/databases'; + Future getQueueDatabases({String? name, int? threshold}) async { + final String apiPath = '/health/queue/databases'; final Map apiParams = { if (name != null) 'name': name, - if (threshold != null) 'threshold': threshold, +if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of background destructive changes that are waiting to be /// processed in the Appwrite internal queue server. - Future getQueueDeletes({int? threshold}) async { - final String apiPath = '/health/queue/deletes'; + Future getQueueDeletes({int? threshold}) async { + final String apiPath = '/health/queue/deletes'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Returns the amount of failed jobs in a given queue. - /// - Future getFailedJobs( - {required enums.Name name, int? threshold}) async { - final String apiPath = - '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + /// + Future getFailedJobs({required enums.Name name, int? threshold}) async { + final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of function executions that are waiting to be processed in /// the Appwrite internal queue server. - Future getQueueFunctions({int? threshold}) async { - final String apiPath = '/health/queue/functions'; + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of logs that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueLogs({int? threshold}) async { - final String apiPath = '/health/queue/logs'; + Future getQueueLogs({int? threshold}) async { + final String apiPath = '/health/queue/logs'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of mails that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueMails({int? threshold}) async { - final String apiPath = '/health/queue/mails'; + Future getQueueMails({int? threshold}) async { + final String apiPath = '/health/queue/mails'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of messages that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueMessaging({int? threshold}) async { - final String apiPath = '/health/queue/messaging'; + Future getQueueMessaging({int? threshold}) async { + final String apiPath = '/health/queue/messaging'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of migrations that are waiting to be processed in the /// Appwrite internal queue server. - Future getQueueMigrations({int? threshold}) async { - final String apiPath = '/health/queue/migrations'; + Future getQueueMigrations({int? threshold}) async { + final String apiPath = '/health/queue/migrations'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of metrics that are waiting to be processed in the Appwrite /// stats resources queue. - Future getQueueStatsResources({int? threshold}) async { - final String apiPath = '/health/queue/stats-resources'; + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of metrics that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueUsage({int? threshold}) async { - final String apiPath = '/health/queue/stats-usage'; + Future getQueueUsage({int? threshold}) async { + final String apiPath = '/health/queue/stats-usage'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Get the number of webhooks that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueWebhooks({int? threshold}) async { - final String apiPath = '/health/queue/webhooks'; + Future getQueueWebhooks({int? threshold}) async { + final String apiPath = '/health/queue/webhooks'; final Map apiParams = { if (threshold != null) 'threshold': threshold, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - } + + } /// Check the Appwrite storage device is up and connection is successful. - Future getStorage() async { - final String apiPath = '/health/storage'; + Future getStorage() async { + final String apiPath = '/health/storage'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - } + + } /// Check the Appwrite local storage device is up and connection is successful. - Future getStorageLocal() async { - final String apiPath = '/health/storage/local'; + Future getStorageLocal() async { + final String apiPath = '/health/storage/local'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - } + + } /// Check the Appwrite server time is synced with Google remote NTP server. We /// use this technology to smoothly handle leap seconds with no disruptive @@ -391,16 +486,21 @@ class Health extends Service { /// used by hundreds of millions of computers and devices to synchronize their /// clocks over the Internet. If your computer sets its own clock, it likely /// uses NTP. - Future getTime() async { - final String apiPath = '/health/time'; + Future getTime() async { + final String apiPath = '/health/time'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthTime.fromMap(res.data); - } + + } } diff --git a/lib/services/locale.dart b/lib/services/locale.dart index ea005f49..db59200f 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,132 +1,172 @@ part of '../dart_appwrite.dart'; -/// The Locale service allows you to customize your app based on your users' -/// location. + /// The Locale service allows you to customize your app based on your users' + /// location. class Locale extends Service { - Locale(super.client); + Locale(super.client); /// Get the current user location based on IP. Returns an object with user /// country code, country name, continent name, continent code, ip address and /// suggested currency. You can use the locale header to get the data in a /// supported language. - /// + /// /// ([IP Geolocation by DB-IP](https://db-ip.com)) - Future get() async { - final String apiPath = '/locale'; + Future get() async { + final String apiPath = '/locale'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Locale.fromMap(res.data); - } + + } /// List of all locale codes in [ISO /// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). - Future listCodes() async { - final String apiPath = '/locale/codes'; + Future listCodes() async { + final String apiPath = '/locale/codes'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LocaleCodeList.fromMap(res.data); - } + + } /// List of all continents. You can use the locale header to get the data in a /// supported language. - Future listContinents() async { - final String apiPath = '/locale/continents'; + Future listContinents() async { + final String apiPath = '/locale/continents'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ContinentList.fromMap(res.data); - } + + } /// List of all countries. You can use the locale header to get the data in a /// supported language. - Future listCountries() async { - final String apiPath = '/locale/countries'; + Future listCountries() async { + final String apiPath = '/locale/countries'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.CountryList.fromMap(res.data); - } + + } /// List of all countries that are currently members of the EU. You can use the /// locale header to get the data in a supported language. - Future listCountriesEU() async { - final String apiPath = '/locale/countries/eu'; + Future listCountriesEU() async { + final String apiPath = '/locale/countries/eu'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.CountryList.fromMap(res.data); - } + + } /// List of all countries phone codes. You can use the locale header to get the /// data in a supported language. - Future listCountriesPhones() async { - final String apiPath = '/locale/countries/phones'; + Future listCountriesPhones() async { + final String apiPath = '/locale/countries/phones'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.PhoneList.fromMap(res.data); - } + + } /// List of all currencies, including currency symbol, name, plural, and /// decimal digits for all major and minor currencies. You can use the locale /// header to get the data in a supported language. - Future listCurrencies() async { - final String apiPath = '/locale/currencies'; + Future listCurrencies() async { + final String apiPath = '/locale/currencies'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.CurrencyList.fromMap(res.data); - } + + } /// List of all languages classified by ISO 639-1 including 2-letter code, name /// in English, and name in the respective language. - Future listLanguages() async { - final String apiPath = '/locale/languages'; + Future listLanguages() async { + final String apiPath = '/locale/languages'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LanguageList.fromMap(res.data); - } + + } } diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 2be72611..22c766cf 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1643 +1,1457 @@ part of '../dart_appwrite.dart'; -/// The Messaging service allows you to send messages to any provider type -/// (SMTP, push notification, SMS, etc.). + /// The Messaging service allows you to send messages to any provider type + /// (SMTP, push notification, SMS, etc.). class Messaging extends Service { - Messaging(super.client); + Messaging(super.client); /// Get a list of all messages from the current Appwrite project. - Future listMessages( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/messages'; + Future listMessages({List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MessageList.fromMap(res.data); - } + + } /// Create a new email message. - Future createEmail( - {required String messageId, - required String subject, - required String content, - List? topics, - List? users, - List? targets, - List? cc, - List? bcc, - List? attachments, - bool? draft, - bool? html, - String? scheduledAt}) async { - final String apiPath = '/messaging/messages/email'; + Future createEmail({required String messageId, required String subject, required String content, List? topics, List? users, List? targets, List? cc, List? bcc, List? attachments, bool? draft, bool? html, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/email'; final Map apiParams = { + 'messageId': messageId, - 'subject': subject, - 'content': content, - if (topics != null) 'topics': topics, - if (users != null) 'users': users, - if (targets != null) 'targets': targets, - if (cc != null) 'cc': cc, - if (bcc != null) 'bcc': bcc, - if (attachments != null) 'attachments': attachments, - if (draft != null) 'draft': draft, - if (html != null) 'html': html, - 'scheduledAt': scheduledAt, +'subject': subject, +'content': content, +if (topics != null) 'topics': topics, +if (users != null) 'users': users, +if (targets != null) 'targets': targets, +if (cc != null) 'cc': cc, +if (bcc != null) 'bcc': bcc, +if (attachments != null) 'attachments': attachments, +if (draft != null) 'draft': draft, +if (html != null) 'html': html, +'scheduledAt': scheduledAt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Update an email message by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - Future updateEmail( - {required String messageId, - List? topics, - List? users, - List? targets, - String? subject, - String? content, - bool? draft, - bool? html, - List? cc, - List? bcc, - String? scheduledAt, - List? attachments}) async { - final String apiPath = '/messaging/messages/email/{messageId}' - .replaceAll('{messageId}', messageId); + /// + Future updateEmail({required String messageId, List? topics, List? users, List? targets, String? subject, String? content, bool? draft, bool? html, List? cc, List? bcc, String? scheduledAt, List? attachments}) async { + final String apiPath = '/messaging/messages/email/{messageId}'.replaceAll('{messageId}', messageId); final Map apiParams = { + 'topics': topics, - 'users': users, - 'targets': targets, - 'subject': subject, - 'content': content, - 'draft': draft, - 'html': html, - 'cc': cc, - 'bcc': bcc, - 'scheduledAt': scheduledAt, - 'attachments': attachments, +'users': users, +'targets': targets, +'subject': subject, +'content': content, +'draft': draft, +'html': html, +'cc': cc, +'bcc': bcc, +'scheduledAt': scheduledAt, +'attachments': attachments, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Create a new push notification. - Future createPush( - {required String messageId, - String? title, - String? body, - List? topics, - List? users, - List? targets, - Map? data, - String? action, - String? image, - String? icon, - String? sound, - String? color, - String? tag, - int? badge, - bool? draft, - String? scheduledAt, - bool? contentAvailable, - bool? critical, - enums.MessagePriority? priority}) async { - final String apiPath = '/messaging/messages/push'; + Future createPush({required String messageId, String? title, String? body, List? topics, List? users, List? targets, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, int? badge, bool? draft, String? scheduledAt, bool? contentAvailable, bool? critical, enums.MessagePriority? priority}) async { + final String apiPath = '/messaging/messages/push'; final Map apiParams = { + 'messageId': messageId, - if (title != null) 'title': title, - if (body != null) 'body': body, - if (topics != null) 'topics': topics, - if (users != null) 'users': users, - if (targets != null) 'targets': targets, - 'data': data, - if (action != null) 'action': action, - if (image != null) 'image': image, - if (icon != null) 'icon': icon, - if (sound != null) 'sound': sound, - if (color != null) 'color': color, - if (tag != null) 'tag': tag, - if (badge != null) 'badge': badge, - if (draft != null) 'draft': draft, - 'scheduledAt': scheduledAt, - if (contentAvailable != null) 'contentAvailable': contentAvailable, - if (critical != null) 'critical': critical, - if (priority != null) 'priority': priority.value, +if (title != null) 'title': title, +if (body != null) 'body': body, +if (topics != null) 'topics': topics, +if (users != null) 'users': users, +if (targets != null) 'targets': targets, +'data': data, +if (action != null) 'action': action, +if (image != null) 'image': image, +if (icon != null) 'icon': icon, +if (sound != null) 'sound': sound, +if (color != null) 'color': color, +if (tag != null) 'tag': tag, +if (badge != null) 'badge': badge, +if (draft != null) 'draft': draft, +'scheduledAt': scheduledAt, +if (contentAvailable != null) 'contentAvailable': contentAvailable, +if (critical != null) 'critical': critical, +if (priority != null) 'priority': priority.value, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Update a push notification by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - Future updatePush( - {required String messageId, - List? topics, - List? users, - List? targets, - String? title, - String? body, - Map? data, - String? action, - String? image, - String? icon, - String? sound, - String? color, - String? tag, - int? badge, - bool? draft, - String? scheduledAt, - bool? contentAvailable, - bool? critical, - enums.MessagePriority? priority}) async { - final String apiPath = '/messaging/messages/push/{messageId}' - .replaceAll('{messageId}', messageId); + /// + Future updatePush({required String messageId, List? topics, List? users, List? targets, String? title, String? body, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, int? badge, bool? draft, String? scheduledAt, bool? contentAvailable, bool? critical, enums.MessagePriority? priority}) async { + final String apiPath = '/messaging/messages/push/{messageId}'.replaceAll('{messageId}', messageId); final Map apiParams = { + 'topics': topics, - 'users': users, - 'targets': targets, - 'title': title, - 'body': body, - 'data': data, - 'action': action, - 'image': image, - 'icon': icon, - 'sound': sound, - 'color': color, - 'tag': tag, - 'badge': badge, - 'draft': draft, - 'scheduledAt': scheduledAt, - 'contentAvailable': contentAvailable, - 'critical': critical, - 'priority': priority?.value, +'users': users, +'targets': targets, +'title': title, +'body': body, +'data': data, +'action': action, +'image': image, +'icon': icon, +'sound': sound, +'color': color, +'tag': tag, +'badge': badge, +'draft': draft, +'scheduledAt': scheduledAt, +'contentAvailable': contentAvailable, +'critical': critical, +'priority': priority?.value, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Create a new SMS message. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead.') - Future createSms( - {required String messageId, - required String content, - List? topics, - List? users, - List? targets, - bool? draft, - String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead.') + Future createSms({required String messageId, required String content, List? topics, List? users, List? targets, bool? draft, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms'; final Map apiParams = { + 'messageId': messageId, - 'content': content, - if (topics != null) 'topics': topics, - if (users != null) 'users': users, - if (targets != null) 'targets': targets, - if (draft != null) 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +if (topics != null) 'topics': topics, +if (users != null) 'users': users, +if (targets != null) 'targets': targets, +if (draft != null) 'draft': draft, +'scheduledAt': scheduledAt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Create a new SMS message. - Future createSMS( - {required String messageId, - required String content, - List? topics, - List? users, - List? targets, - bool? draft, - String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms'; + Future createSMS({required String messageId, required String content, List? topics, List? users, List? targets, bool? draft, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms'; final Map apiParams = { + 'messageId': messageId, - 'content': content, - if (topics != null) 'topics': topics, - if (users != null) 'users': users, - if (targets != null) 'targets': targets, - if (draft != null) 'draft': draft, - 'scheduledAt': scheduledAt, +'content': content, +if (topics != null) 'topics': topics, +if (users != null) 'users': users, +if (targets != null) 'targets': targets, +if (draft != null) 'draft': draft, +'scheduledAt': scheduledAt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Update an SMS message by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead.') - Future updateSms( - {required String messageId, - List? topics, - List? users, - List? targets, - String? content, - bool? draft, - String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms/{messageId}' - .replaceAll('{messageId}', messageId); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead.') + Future updateSms({required String messageId, List? topics, List? users, List? targets, String? content, bool? draft, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); final Map apiParams = { + 'topics': topics, - 'users': users, - 'targets': targets, - 'content': content, - 'draft': draft, - 'scheduledAt': scheduledAt, +'users': users, +'targets': targets, +'content': content, +'draft': draft, +'scheduledAt': scheduledAt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Update an SMS message by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - Future updateSMS( - {required String messageId, - List? topics, - List? users, - List? targets, - String? content, - bool? draft, - String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms/{messageId}' - .replaceAll('{messageId}', messageId); + /// + Future updateSMS({required String messageId, List? topics, List? users, List? targets, String? content, bool? draft, String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); final Map apiParams = { + 'topics': topics, - 'users': users, - 'targets': targets, - 'content': content, - 'draft': draft, - 'scheduledAt': scheduledAt, +'users': users, +'targets': targets, +'content': content, +'draft': draft, +'scheduledAt': scheduledAt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Get a message by its unique ID. - /// - Future getMessage({required String messageId}) async { - final String apiPath = - '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); + /// + Future getMessage({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - } + + } /// Delete a message. If the message is not a draft or scheduled, but has been /// sent, this will not recall the message. - Future delete({required String messageId}) async { - final String apiPath = - '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); + Future delete({required String messageId}) async { + final String apiPath = '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs( - {required String messageId, List? queries, bool? total}) async { - final String apiPath = '/messaging/messages/{messageId}/logs' - .replaceAll('{messageId}', messageId); + Future listMessageLogs({required String messageId, List? queries, bool? total}) async { + final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - } + + } /// Get a list of the targets associated with a message. - Future listTargets( - {required String messageId, List? queries, bool? total}) async { - final String apiPath = '/messaging/messages/{messageId}/targets' - .replaceAll('{messageId}', messageId); + Future listTargets({required String messageId, List? queries, bool? total}) async { + final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TargetList.fromMap(res.data); - } + + } /// Get a list of all providers from the current Appwrite project. - Future listProviders( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/providers'; + Future listProviders({List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ProviderList.fromMap(res.data); - } + + } /// Create a new Apple Push Notification service provider. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead.') - Future createApnsProvider( - {required String providerId, - required String name, - String? authKey, - String? authKeyId, - String? teamId, - String? bundleId, - bool? sandbox, - bool? enabled}) async { - final String apiPath = '/messaging/providers/apns'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead.') + Future createApnsProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox, bool? enabled}) async { + final String apiPath = '/messaging/providers/apns'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (authKey != null) 'authKey': authKey, - if (authKeyId != null) 'authKeyId': authKeyId, - if (teamId != null) 'teamId': teamId, - if (bundleId != null) 'bundleId': bundleId, - if (sandbox != null) 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +if (authKey != null) 'authKey': authKey, +if (authKeyId != null) 'authKeyId': authKeyId, +if (teamId != null) 'teamId': teamId, +if (bundleId != null) 'bundleId': bundleId, +if (sandbox != null) 'sandbox': sandbox, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Apple Push Notification service provider. - Future createAPNSProvider( - {required String providerId, - required String name, - String? authKey, - String? authKeyId, - String? teamId, - String? bundleId, - bool? sandbox, - bool? enabled}) async { - final String apiPath = '/messaging/providers/apns'; + Future createAPNSProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox, bool? enabled}) async { + final String apiPath = '/messaging/providers/apns'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (authKey != null) 'authKey': authKey, - if (authKeyId != null) 'authKeyId': authKeyId, - if (teamId != null) 'teamId': teamId, - if (bundleId != null) 'bundleId': bundleId, - if (sandbox != null) 'sandbox': sandbox, - 'enabled': enabled, +'name': name, +if (authKey != null) 'authKey': authKey, +if (authKeyId != null) 'authKeyId': authKeyId, +if (teamId != null) 'teamId': teamId, +if (bundleId != null) 'bundleId': bundleId, +if (sandbox != null) 'sandbox': sandbox, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Apple Push Notification service provider by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead.') - Future updateApnsProvider( - {required String providerId, - String? name, - bool? enabled, - String? authKey, - String? authKeyId, - String? teamId, - String? bundleId, - bool? sandbox}) async { - final String apiPath = '/messaging/providers/apns/{providerId}' - .replaceAll('{providerId}', providerId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead.') + Future updateApnsProvider({required String providerId, String? name, bool? enabled, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox}) async { + final String apiPath = '/messaging/providers/apns/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (authKey != null) 'authKey': authKey, - if (authKeyId != null) 'authKeyId': authKeyId, - if (teamId != null) 'teamId': teamId, - if (bundleId != null) 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +if (authKey != null) 'authKey': authKey, +if (authKeyId != null) 'authKeyId': authKeyId, +if (teamId != null) 'teamId': teamId, +if (bundleId != null) 'bundleId': bundleId, +'sandbox': sandbox, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Apple Push Notification service provider by its unique ID. - Future updateAPNSProvider( - {required String providerId, - String? name, - bool? enabled, - String? authKey, - String? authKeyId, - String? teamId, - String? bundleId, - bool? sandbox}) async { - final String apiPath = '/messaging/providers/apns/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateAPNSProvider({required String providerId, String? name, bool? enabled, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox}) async { + final String apiPath = '/messaging/providers/apns/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (authKey != null) 'authKey': authKey, - if (authKeyId != null) 'authKeyId': authKeyId, - if (teamId != null) 'teamId': teamId, - if (bundleId != null) 'bundleId': bundleId, - 'sandbox': sandbox, +'enabled': enabled, +if (authKey != null) 'authKey': authKey, +if (authKeyId != null) 'authKeyId': authKeyId, +if (teamId != null) 'teamId': teamId, +if (bundleId != null) 'bundleId': bundleId, +'sandbox': sandbox, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Firebase Cloud Messaging provider. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead.') - Future createFcmProvider( - {required String providerId, - required String name, - Map? serviceAccountJSON, - bool? enabled}) async { - final String apiPath = '/messaging/providers/fcm'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead.') + Future createFcmProvider({required String providerId, required String name, Map? serviceAccountJSON, bool? enabled}) async { + final String apiPath = '/messaging/providers/fcm'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - 'serviceAccountJSON': serviceAccountJSON, - 'enabled': enabled, +'name': name, +'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Firebase Cloud Messaging provider. - Future createFCMProvider( - {required String providerId, - required String name, - Map? serviceAccountJSON, - bool? enabled}) async { - final String apiPath = '/messaging/providers/fcm'; + Future createFCMProvider({required String providerId, required String name, Map? serviceAccountJSON, bool? enabled}) async { + final String apiPath = '/messaging/providers/fcm'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - 'serviceAccountJSON': serviceAccountJSON, - 'enabled': enabled, +'name': name, +'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Firebase Cloud Messaging provider by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead.') - Future updateFcmProvider( - {required String providerId, - String? name, - bool? enabled, - Map? serviceAccountJSON}) async { - final String apiPath = '/messaging/providers/fcm/{providerId}' - .replaceAll('{providerId}', providerId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead.') + Future updateFcmProvider({required String providerId, String? name, bool? enabled, Map? serviceAccountJSON}) async { + final String apiPath = '/messaging/providers/fcm/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Firebase Cloud Messaging provider by its unique ID. - Future updateFCMProvider( - {required String providerId, - String? name, - bool? enabled, - Map? serviceAccountJSON}) async { - final String apiPath = '/messaging/providers/fcm/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateFCMProvider({required String providerId, String? name, bool? enabled, Map? serviceAccountJSON}) async { + final String apiPath = '/messaging/providers/fcm/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - 'serviceAccountJSON': serviceAccountJSON, +'enabled': enabled, +'serviceAccountJSON': serviceAccountJSON, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Mailgun provider. - Future createMailgunProvider( - {required String providerId, - required String name, - String? apiKey, - String? domain, - bool? isEuRegion, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/mailgun'; + Future createMailgunProvider({required String providerId, required String name, String? apiKey, String? domain, bool? isEuRegion, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/mailgun'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (apiKey != null) 'apiKey': apiKey, - if (domain != null) 'domain': domain, - 'isEuRegion': isEuRegion, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +if (apiKey != null) 'apiKey': apiKey, +if (domain != null) 'domain': domain, +'isEuRegion': isEuRegion, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Mailgun provider by its unique ID. - Future updateMailgunProvider( - {required String providerId, - String? name, - String? apiKey, - String? domain, - bool? isEuRegion, - bool? enabled, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail}) async { - final String apiPath = '/messaging/providers/mailgun/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateMailgunProvider({required String providerId, String? name, String? apiKey, String? domain, bool? isEuRegion, bool? enabled, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail}) async { + final String apiPath = '/messaging/providers/mailgun/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - if (apiKey != null) 'apiKey': apiKey, - if (domain != null) 'domain': domain, - 'isEuRegion': isEuRegion, - 'enabled': enabled, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, +if (apiKey != null) 'apiKey': apiKey, +if (domain != null) 'domain': domain, +'isEuRegion': isEuRegion, +'enabled': enabled, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new MSG91 provider. - Future createMsg91Provider( - {required String providerId, - required String name, - String? templateId, - String? senderId, - String? authKey, - bool? enabled}) async { - final String apiPath = '/messaging/providers/msg91'; + Future createMsg91Provider({required String providerId, required String name, String? templateId, String? senderId, String? authKey, bool? enabled}) async { + final String apiPath = '/messaging/providers/msg91'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (templateId != null) 'templateId': templateId, - if (senderId != null) 'senderId': senderId, - if (authKey != null) 'authKey': authKey, - 'enabled': enabled, +'name': name, +if (templateId != null) 'templateId': templateId, +if (senderId != null) 'senderId': senderId, +if (authKey != null) 'authKey': authKey, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a MSG91 provider by its unique ID. - Future updateMsg91Provider( - {required String providerId, - String? name, - bool? enabled, - String? templateId, - String? senderId, - String? authKey}) async { - final String apiPath = '/messaging/providers/msg91/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateMsg91Provider({required String providerId, String? name, bool? enabled, String? templateId, String? senderId, String? authKey}) async { + final String apiPath = '/messaging/providers/msg91/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (templateId != null) 'templateId': templateId, - if (senderId != null) 'senderId': senderId, - if (authKey != null) 'authKey': authKey, +'enabled': enabled, +if (templateId != null) 'templateId': templateId, +if (senderId != null) 'senderId': senderId, +if (authKey != null) 'authKey': authKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Resend provider. - Future createResendProvider( - {required String providerId, - required String name, - String? apiKey, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/resend'; + Future createResendProvider({required String providerId, required String name, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/resend'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (apiKey != null) 'apiKey': apiKey, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +if (apiKey != null) 'apiKey': apiKey, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Resend provider by its unique ID. - Future updateResendProvider( - {required String providerId, - String? name, - bool? enabled, - String? apiKey, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail}) async { - final String apiPath = '/messaging/providers/resend/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateResendProvider({required String providerId, String? name, bool? enabled, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail}) async { + final String apiPath = '/messaging/providers/resend/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (apiKey != null) 'apiKey': apiKey, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, +if (apiKey != null) 'apiKey': apiKey, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Sendgrid provider. - Future createSendgridProvider( - {required String providerId, - required String name, - String? apiKey, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/sendgrid'; + Future createSendgridProvider({required String providerId, required String name, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/sendgrid'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (apiKey != null) 'apiKey': apiKey, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +if (apiKey != null) 'apiKey': apiKey, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Sendgrid provider by its unique ID. - Future updateSendgridProvider( - {required String providerId, - String? name, - bool? enabled, - String? apiKey, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail}) async { - final String apiPath = '/messaging/providers/sendgrid/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateSendgridProvider({required String providerId, String? name, bool? enabled, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail}) async { + final String apiPath = '/messaging/providers/sendgrid/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (apiKey != null) 'apiKey': apiKey, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, +if (apiKey != null) 'apiKey': apiKey, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new SMTP provider. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead.') - Future createSmtpProvider( - {required String providerId, - required String name, - required String host, - int? port, - String? username, - String? password, - enums.SmtpEncryption? encryption, - bool? autoTLS, - String? mailer, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp'; + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead.') + Future createSmtpProvider({required String providerId, required String name, required String host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - 'host': host, - if (port != null) 'port': port, - if (username != null) 'username': username, - if (password != null) 'password': password, - if (encryption != null) 'encryption': encryption.value, - if (autoTLS != null) 'autoTLS': autoTLS, - if (mailer != null) 'mailer': mailer, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'host': host, +if (port != null) 'port': port, +if (username != null) 'username': username, +if (password != null) 'password': password, +if (encryption != null) 'encryption': encryption.value, +if (autoTLS != null) 'autoTLS': autoTLS, +if (mailer != null) 'mailer': mailer, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new SMTP provider. - Future createSMTPProvider( - {required String providerId, - required String name, - required String host, - int? port, - String? username, - String? password, - enums.SmtpEncryption? encryption, - bool? autoTLS, - String? mailer, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp'; + Future createSMTPProvider({required String providerId, required String name, required String host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - 'host': host, - if (port != null) 'port': port, - if (username != null) 'username': username, - if (password != null) 'password': password, - if (encryption != null) 'encryption': encryption.value, - if (autoTLS != null) 'autoTLS': autoTLS, - if (mailer != null) 'mailer': mailer, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +'name': name, +'host': host, +if (port != null) 'port': port, +if (username != null) 'username': username, +if (password != null) 'password': password, +if (encryption != null) 'encryption': encryption.value, +if (autoTLS != null) 'autoTLS': autoTLS, +if (mailer != null) 'mailer': mailer, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a SMTP provider by its unique ID. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead.') - Future updateSmtpProvider( - {required String providerId, - String? name, - String? host, - int? port, - String? username, - String? password, - enums.SmtpEncryption? encryption, - bool? autoTLS, - String? mailer, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp/{providerId}' - .replaceAll('{providerId}', providerId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead.') + Future updateSmtpProvider({required String providerId, String? name, String? host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - if (host != null) 'host': host, - 'port': port, - if (username != null) 'username': username, - if (password != null) 'password': password, - if (encryption != null) 'encryption': encryption.value, - 'autoTLS': autoTLS, - if (mailer != null) 'mailer': mailer, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +if (host != null) 'host': host, +'port': port, +if (username != null) 'username': username, +if (password != null) 'password': password, +if (encryption != null) 'encryption': encryption.value, +'autoTLS': autoTLS, +if (mailer != null) 'mailer': mailer, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a SMTP provider by its unique ID. - Future updateSMTPProvider( - {required String providerId, - String? name, - String? host, - int? port, - String? username, - String? password, - enums.SmtpEncryption? encryption, - bool? autoTLS, - String? mailer, - String? fromName, - String? fromEmail, - String? replyToName, - String? replyToEmail, - bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateSMTPProvider({required String providerId, String? name, String? host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - if (host != null) 'host': host, - 'port': port, - if (username != null) 'username': username, - if (password != null) 'password': password, - if (encryption != null) 'encryption': encryption.value, - 'autoTLS': autoTLS, - if (mailer != null) 'mailer': mailer, - if (fromName != null) 'fromName': fromName, - if (fromEmail != null) 'fromEmail': fromEmail, - if (replyToName != null) 'replyToName': replyToName, - if (replyToEmail != null) 'replyToEmail': replyToEmail, - 'enabled': enabled, +if (host != null) 'host': host, +'port': port, +if (username != null) 'username': username, +if (password != null) 'password': password, +if (encryption != null) 'encryption': encryption.value, +'autoTLS': autoTLS, +if (mailer != null) 'mailer': mailer, +if (fromName != null) 'fromName': fromName, +if (fromEmail != null) 'fromEmail': fromEmail, +if (replyToName != null) 'replyToName': replyToName, +if (replyToEmail != null) 'replyToEmail': replyToEmail, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Telesign provider. - Future createTelesignProvider( - {required String providerId, - required String name, - String? from, - String? customerId, - String? apiKey, - bool? enabled}) async { - final String apiPath = '/messaging/providers/telesign'; + Future createTelesignProvider({required String providerId, required String name, String? from, String? customerId, String? apiKey, bool? enabled}) async { + final String apiPath = '/messaging/providers/telesign'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (from != null) 'from': from, - if (customerId != null) 'customerId': customerId, - if (apiKey != null) 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +if (from != null) 'from': from, +if (customerId != null) 'customerId': customerId, +if (apiKey != null) 'apiKey': apiKey, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Telesign provider by its unique ID. - Future updateTelesignProvider( - {required String providerId, - String? name, - bool? enabled, - String? customerId, - String? apiKey, - String? from}) async { - final String apiPath = '/messaging/providers/telesign/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateTelesignProvider({required String providerId, String? name, bool? enabled, String? customerId, String? apiKey, String? from}) async { + final String apiPath = '/messaging/providers/telesign/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (customerId != null) 'customerId': customerId, - if (apiKey != null) 'apiKey': apiKey, - if (from != null) 'from': from, +'enabled': enabled, +if (customerId != null) 'customerId': customerId, +if (apiKey != null) 'apiKey': apiKey, +if (from != null) 'from': from, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Textmagic provider. - Future createTextmagicProvider( - {required String providerId, - required String name, - String? from, - String? username, - String? apiKey, - bool? enabled}) async { - final String apiPath = '/messaging/providers/textmagic'; + Future createTextmagicProvider({required String providerId, required String name, String? from, String? username, String? apiKey, bool? enabled}) async { + final String apiPath = '/messaging/providers/textmagic'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (from != null) 'from': from, - if (username != null) 'username': username, - if (apiKey != null) 'apiKey': apiKey, - 'enabled': enabled, +'name': name, +if (from != null) 'from': from, +if (username != null) 'username': username, +if (apiKey != null) 'apiKey': apiKey, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Textmagic provider by its unique ID. - Future updateTextmagicProvider( - {required String providerId, - String? name, - bool? enabled, - String? username, - String? apiKey, - String? from}) async { - final String apiPath = '/messaging/providers/textmagic/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateTextmagicProvider({required String providerId, String? name, bool? enabled, String? username, String? apiKey, String? from}) async { + final String apiPath = '/messaging/providers/textmagic/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (username != null) 'username': username, - if (apiKey != null) 'apiKey': apiKey, - if (from != null) 'from': from, +'enabled': enabled, +if (username != null) 'username': username, +if (apiKey != null) 'apiKey': apiKey, +if (from != null) 'from': from, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Twilio provider. - Future createTwilioProvider( - {required String providerId, - required String name, - String? from, - String? accountSid, - String? authToken, - bool? enabled}) async { - final String apiPath = '/messaging/providers/twilio'; + Future createTwilioProvider({required String providerId, required String name, String? from, String? accountSid, String? authToken, bool? enabled}) async { + final String apiPath = '/messaging/providers/twilio'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (from != null) 'from': from, - if (accountSid != null) 'accountSid': accountSid, - if (authToken != null) 'authToken': authToken, - 'enabled': enabled, +'name': name, +if (from != null) 'from': from, +if (accountSid != null) 'accountSid': accountSid, +if (authToken != null) 'authToken': authToken, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Twilio provider by its unique ID. - Future updateTwilioProvider( - {required String providerId, - String? name, - bool? enabled, - String? accountSid, - String? authToken, - String? from}) async { - final String apiPath = '/messaging/providers/twilio/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateTwilioProvider({required String providerId, String? name, bool? enabled, String? accountSid, String? authToken, String? from}) async { + final String apiPath = '/messaging/providers/twilio/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (accountSid != null) 'accountSid': accountSid, - if (authToken != null) 'authToken': authToken, - if (from != null) 'from': from, +'enabled': enabled, +if (accountSid != null) 'accountSid': accountSid, +if (authToken != null) 'authToken': authToken, +if (from != null) 'from': from, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Create a new Vonage provider. - Future createVonageProvider( - {required String providerId, - required String name, - String? from, - String? apiKey, - String? apiSecret, - bool? enabled}) async { - final String apiPath = '/messaging/providers/vonage'; + Future createVonageProvider({required String providerId, required String name, String? from, String? apiKey, String? apiSecret, bool? enabled}) async { + final String apiPath = '/messaging/providers/vonage'; final Map apiParams = { + 'providerId': providerId, - 'name': name, - if (from != null) 'from': from, - if (apiKey != null) 'apiKey': apiKey, - if (apiSecret != null) 'apiSecret': apiSecret, - 'enabled': enabled, +'name': name, +if (from != null) 'from': from, +if (apiKey != null) 'apiKey': apiKey, +if (apiSecret != null) 'apiSecret': apiSecret, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Update a Vonage provider by its unique ID. - Future updateVonageProvider( - {required String providerId, - String? name, - bool? enabled, - String? apiKey, - String? apiSecret, - String? from}) async { - final String apiPath = '/messaging/providers/vonage/{providerId}' - .replaceAll('{providerId}', providerId); + Future updateVonageProvider({required String providerId, String? name, bool? enabled, String? apiKey, String? apiSecret, String? from}) async { + final String apiPath = '/messaging/providers/vonage/{providerId}'.replaceAll('{providerId}', providerId); final Map apiParams = { + if (name != null) 'name': name, - 'enabled': enabled, - if (apiKey != null) 'apiKey': apiKey, - if (apiSecret != null) 'apiSecret': apiSecret, - if (from != null) 'from': from, +'enabled': enabled, +if (apiKey != null) 'apiKey': apiKey, +if (apiSecret != null) 'apiSecret': apiSecret, +if (from != null) 'from': from, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Get a provider by its unique ID. - /// - Future getProvider({required String providerId}) async { - final String apiPath = '/messaging/providers/{providerId}' - .replaceAll('{providerId}', providerId); + /// + Future getProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll('{providerId}', providerId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - } + + } /// Delete a provider by its unique ID. - Future deleteProvider({required String providerId}) async { - final String apiPath = '/messaging/providers/{providerId}' - .replaceAll('{providerId}', providerId); + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}'.replaceAll('{providerId}', providerId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs( - {required String providerId, List? queries, bool? total}) async { - final String apiPath = '/messaging/providers/{providerId}/logs' - .replaceAll('{providerId}', providerId); + Future listProviderLogs({required String providerId, List? queries, bool? total}) async { + final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - } + + } /// Get the subscriber activity logs listed by its unique ID. - Future listSubscriberLogs( - {required String subscriberId, - List? queries, - bool? total}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs' - .replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs({required String subscriberId, List? queries, bool? total}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - } + + } /// Get a list of all topics from the current Appwrite project. - Future listTopics( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/topics'; + Future listTopics({List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TopicList.fromMap(res.data); - } + + } /// Create a new topic. - Future createTopic( - {required String topicId, - required String name, - List? subscribe}) async { - final String apiPath = '/messaging/topics'; + Future createTopic({required String topicId, required String name, List? subscribe}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { + 'topicId': topicId, - 'name': name, - if (subscribe != null) 'subscribe': subscribe, +'name': name, +if (subscribe != null) 'subscribe': subscribe, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Topic.fromMap(res.data); - } + + } /// Get a topic by its unique ID. - /// - Future getTopic({required String topicId}) async { - final String apiPath = - '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + /// + Future getTopic({required String topicId}) async { + final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Topic.fromMap(res.data); - } + + } /// Update a topic by its unique ID. - /// - Future updateTopic( - {required String topicId, String? name, List? subscribe}) async { - final String apiPath = - '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + /// + Future updateTopic({required String topicId, String? name, List? subscribe}) async { + final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); final Map apiParams = { + 'name': name, - 'subscribe': subscribe, +'subscribe': subscribe, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Topic.fromMap(res.data); - } + + } /// Delete a topic by its unique ID. - Future deleteTopic({required String topicId}) async { - final String apiPath = - '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + Future deleteTopic({required String topicId}) async { + final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs( - {required String topicId, List? queries, bool? total}) async { - final String apiPath = - '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + Future listTopicLogs({required String topicId, List? queries, bool? total}) async { + final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - } + + } /// Get a list of all subscribers from the current Appwrite project. - Future listSubscribers( - {required String topicId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers' - .replaceAll('{topicId}', topicId); + Future listSubscribers({required String topicId, List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.SubscriberList.fromMap(res.data); - } + + } /// Create a new subscriber. - Future createSubscriber( - {required String topicId, - required String subscriberId, - required String targetId}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers' - .replaceAll('{topicId}', topicId); + Future createSubscriber({required String topicId, required String subscriberId, required String targetId}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); final Map apiParams = { + 'subscriberId': subscriberId, - 'targetId': targetId, +'targetId': targetId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Subscriber.fromMap(res.data); - } + + } /// Get a subscriber by its unique ID. - /// - Future getSubscriber( - {required String topicId, required String subscriberId}) async { - final String apiPath = - '/messaging/topics/{topicId}/subscribers/{subscriberId}' - .replaceAll('{topicId}', topicId) - .replaceAll('{subscriberId}', subscriberId); + /// + Future getSubscriber({required String topicId, required String subscriberId}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replaceAll('{topicId}', topicId).replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Subscriber.fromMap(res.data); - } + + } /// Delete a subscriber by its unique ID. - Future deleteSubscriber( - {required String topicId, required String subscriberId}) async { - final String apiPath = - '/messaging/topics/{topicId}/subscribers/{subscriberId}' - .replaceAll('{topicId}', topicId) - .replaceAll('{subscriberId}', subscriberId); + Future deleteSubscriber({required String topicId, required String subscriberId}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replaceAll('{topicId}', topicId).replaceAll('{subscriberId}', subscriberId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/presences.dart b/lib/services/presences.dart new file mode 100644 index 00000000..1b7fc69d --- /dev/null +++ b/lib/services/presences.dart @@ -0,0 +1,117 @@ +part of '../dart_appwrite.dart'; + +class Presences extends Service { + Presences(super.client); + + /// List presence logs. + Future list({List? queries, bool? total, int? ttl}) async { + final String apiPath = '/presences'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, +if (ttl != null) 'ttl': ttl, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PresenceList.fromMap(res.data); + + } + + /// Get a presence log by its unique ID. + Future get({required String presenceId}) async { + final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Presence.fromMap(res.data); + + } + + /// Create or update a presence log by its unique ID. + Future upsert({required String presenceId, required String? userId, required String status, List? permissions, String? expiresAt, Map? metadata}) async { + final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = { + + 'userId': userId, +'status': status, +'permissions': permissions, +'expiresAt': expiresAt, +if (metadata != null) 'metadata': metadata, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Presence.fromMap(res.data); + + } + + /// Update a presence log by its unique ID. + Future updatePresence({required String presenceId, required String? userId, String? status, String? expiresAt, Map? metadata, List? permissions, bool? purge}) async { + final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = { + + 'userId': userId, +'status': status, +'expiresAt': expiresAt, +'metadata': metadata, +'permissions': permissions, +if (purge != null) 'purge': purge, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Presence.fromMap(res.data); + + } + + /// Delete a presence log by its unique ID. + Future delete({required String presenceId}) async { + final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } +} diff --git a/lib/services/project.dart b/lib/services/project.dart index d47bb82d..0baef815 100644 --- a/lib/services/project.dart +++ b/lib/services/project.dart @@ -1,591 +1,2370 @@ part of '../dart_appwrite.dart'; -/// The Project service allows you to manage all the projects in your Appwrite -/// server. + /// The Project service allows you to manage all the projects in your Appwrite + /// server. class Project extends Service { - Project(super.client); + Project(super.client); + + /// Delete a project. + Future delete() async { + final String apiPath = '/project'; + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// Update properties of a specific auth method. Use this endpoint to enable or + /// disable a method in your project. + Future updateAuthMethod({required enums.MethodId methodId, required bool enabled}) async { + final String apiPath = '/project/auth-methods/{methodId}'.replaceAll('{methodId}', methodId.value); + + final Map apiParams = { + + 'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + + } /// Get a list of all API keys from the current project. - Future listKeys({List? queries, bool? total}) async { - final String apiPath = '/project/keys'; + Future listKeys({List? queries, bool? total}) async { + final String apiPath = '/project/keys'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.KeyList.fromMap(res.data); + + } + + /// Create a new API key. It's recommended to have multiple API keys with + /// strict scopes for separate functions within your project. + /// + /// You can also create an ephemeral API key if you need a short-lived key + /// instead. + Future createKey({required String keyId, required String name, required List scopes, String? expire}) async { + final String apiPath = '/project/keys'; + + final Map apiParams = { + + 'keyId': keyId, +'name': name, +'scopes': scopes.map((e) => e.value).toList(), +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Key.fromMap(res.data); + + } + + /// Create a new ephemeral API key. It's recommended to have multiple API keys + /// with strict scopes for separate functions within your project. + /// + /// You can also create a standard API key if you need a longer-lived key + /// instead. + Future createEphemeralKey({required List scopes, required int duration}) async { + final String apiPath = '/project/keys/ephemeral'; + + final Map apiParams = { + + 'scopes': scopes.map((e) => e.value).toList(), +'duration': duration, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.EphemeralKey.fromMap(res.data); + + } + + /// Get a key by its unique ID. + Future getKey({required String keyId}) async { + final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Key.fromMap(res.data); + + } + + /// Update a key by its unique ID. Use this endpoint to update the name, + /// scopes, or expiration time of an API key. + Future updateKey({required String keyId, required String name, required List scopes, String? expire}) async { + final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + + final Map apiParams = { + + 'name': name, +'scopes': scopes.map((e) => e.value).toList(), +'expire': expire, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Key.fromMap(res.data); + + } + + /// Delete a key by its unique ID. Once deleted, the key can no longer be used + /// to authenticate API calls. + Future deleteKey({required String keyId}) async { + final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// Update the project labels. Labels can be used to easily filter projects in + /// an organization. + Future updateLabels({required List labels}) async { + final String apiPath = '/project/labels'; + + final Map apiParams = { + + 'labels': labels, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.Project.fromMap(res.data); + + } + + /// Get a list of all mock phones in the project. This endpoint returns an + /// array of all mock phones and their OTPs. + Future listMockPhones({List? queries, bool? total}) async { + final String apiPath = '/project/mock-phones'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumberList.fromMap(res.data); + + } + + /// Create a new mock phone for your project. Use this endpoint to register a + /// mock phone number and its sign-in OTP for your testers. + Future createMockPhone({required String number, required String otp}) async { + final String apiPath = '/project/mock-phones'; + + final Map apiParams = { + + 'number': number, +'otp': otp, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumber.fromMap(res.data); + + } + + /// Get a mock phone by its unique number. This endpoint returns the mock + /// phone's OTP. + Future getMockPhone({required String number}) async { + final String apiPath = '/project/mock-phones/{number}'.replaceAll('{number}', number); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumber.fromMap(res.data); + + } + + /// Update a mock phone by its unique number. Use this endpoint to update the + /// mock phone's OTP. + Future updateMockPhone({required String number, required String otp}) async { + final String apiPath = '/project/mock-phones/{number}'.replaceAll('{number}', number); + + final Map apiParams = { + + 'otp': otp, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.MockNumber.fromMap(res.data); + + } + + /// Delete a mock phone by its unique number. This endpoint removes the mock + /// phone and its OTP configuration from the project. + Future deleteMockPhone({required String number}) async { + final String apiPath = '/project/mock-phones/{number}'.replaceAll('{number}', number); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// Get a list of all OAuth2 providers supported by the server, along with the + /// project's configuration for each. Credential fields are write-only and + /// always returned empty. + Future listOAuth2Providers({List? queries, bool? total}) async { + final String apiPath = '/project/oauth2'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2ProviderList.fromMap(res.data); + + } + + /// Get a single OAuth2 provider configuration. Credential fields (client + /// secret, p8 file, key/team IDs) are write-only and always returned empty. + Future getOAuth2Provider({required enums.ProviderId providerId}) async { + final String apiPath = '/project/oauth2/:provider'; + + final Map apiParams = { + 'providerId': providerId.value, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return () { + if (res.data is! Map) { + throw StateError('Unable to match response to any expected response model.'); + } + + final response = res.data as Map; + if (response['\$id'] == 'github') { + return models.OAuth2Github.fromMap(response); + } + if (response['\$id'] == 'discord') { + return models.OAuth2Discord.fromMap(response); + } + if (response['\$id'] == 'figma') { + return models.OAuth2Figma.fromMap(response); + } + if (response['\$id'] == 'dropbox') { + return models.OAuth2Dropbox.fromMap(response); + } + if (response['\$id'] == 'dailymotion') { + return models.OAuth2Dailymotion.fromMap(response); + } + if (response['\$id'] == 'bitbucket') { + return models.OAuth2Bitbucket.fromMap(response); + } + if (response['\$id'] == 'bitly') { + return models.OAuth2Bitly.fromMap(response); + } + if (response['\$id'] == 'box') { + return models.OAuth2Box.fromMap(response); + } + if (response['\$id'] == 'autodesk') { + return models.OAuth2Autodesk.fromMap(response); + } + if (response['\$id'] == 'google') { + return models.OAuth2Google.fromMap(response); + } + if (response['\$id'] == 'zoom') { + return models.OAuth2Zoom.fromMap(response); + } + if (response['\$id'] == 'zoho') { + return models.OAuth2Zoho.fromMap(response); + } + if (response['\$id'] == 'yandex') { + return models.OAuth2Yandex.fromMap(response); + } + if (response['\$id'] == 'x') { + return models.OAuth2X.fromMap(response); + } + if (response['\$id'] == 'wordpress') { + return models.OAuth2WordPress.fromMap(response); + } + if (response['\$id'] == 'twitch') { + return models.OAuth2Twitch.fromMap(response); + } + if (response['\$id'] == 'stripe') { + return models.OAuth2Stripe.fromMap(response); + } + if (response['\$id'] == 'spotify') { + return models.OAuth2Spotify.fromMap(response); + } + if (response['\$id'] == 'slack') { + return models.OAuth2Slack.fromMap(response); + } + if (response['\$id'] == 'podio') { + return models.OAuth2Podio.fromMap(response); + } + if (response['\$id'] == 'notion') { + return models.OAuth2Notion.fromMap(response); + } + if (response['\$id'] == 'salesforce') { + return models.OAuth2Salesforce.fromMap(response); + } + if (response['\$id'] == 'yahoo') { + return models.OAuth2Yahoo.fromMap(response); + } + if (response['\$id'] == 'linkedin') { + return models.OAuth2Linkedin.fromMap(response); + } + if (response['\$id'] == 'disqus') { + return models.OAuth2Disqus.fromMap(response); + } + if (response['\$id'] == 'amazon') { + return models.OAuth2Amazon.fromMap(response); + } + if (response['\$id'] == 'etsy') { + return models.OAuth2Etsy.fromMap(response); + } + if (response['\$id'] == 'facebook') { + return models.OAuth2Facebook.fromMap(response); + } + if (response['\$id'] == 'tradeshiftBox') { + return models.OAuth2Tradeshift.fromMap(response); + } + if (response['\$id'] == 'paypalSandbox') { + return models.OAuth2Paypal.fromMap(response); + } + if (response['\$id'] == 'gitlab') { + return models.OAuth2Gitlab.fromMap(response); + } + if (response['\$id'] == 'authentik') { + return models.OAuth2Authentik.fromMap(response); + } + if (response['\$id'] == 'auth0') { + return models.OAuth2Auth0.fromMap(response); + } + if (response['\$id'] == 'fusionauth') { + return models.OAuth2FusionAuth.fromMap(response); + } + if (response['\$id'] == 'keycloak') { + return models.OAuth2Keycloak.fromMap(response); + } + if (response['\$id'] == 'oidc') { + return models.OAuth2Oidc.fromMap(response); + } + if (response['\$id'] == 'apple') { + return models.OAuth2Apple.fromMap(response); + } + if (response['\$id'] == 'okta') { + return models.OAuth2Okta.fromMap(response); + } + if (response['\$id'] == 'kick') { + return models.OAuth2Kick.fromMap(response); + } + if (response['\$id'] == 'microsoft') { + return models.OAuth2Microsoft.fromMap(response); + } + + throw StateError('Unable to match response to any expected response model.'); + }(); + + } + + /// Update the project OAuth2 Amazon configuration. + Future updateOAuth2Amazon({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/amazon'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Amazon.fromMap(res.data); + + } + + /// Update the project OAuth2 Apple configuration. + Future updateOAuth2Apple({String? serviceId, String? keyId, String? teamId, String? p8File, bool? enabled}) async { + final String apiPath = '/project/oauth2/apple'; + + final Map apiParams = { + + 'serviceId': serviceId, +'keyId': keyId, +'teamId': teamId, +'p8File': p8File, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Apple.fromMap(res.data); + + } + + /// Update the project OAuth2 Auth0 configuration. + Future updateOAuth2Auth0({String? clientId, String? clientSecret, String? endpoint, bool? enabled}) async { + final String apiPath = '/project/oauth2/auth0'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'endpoint': endpoint, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Auth0.fromMap(res.data); + + } + + /// Update the project OAuth2 Authentik configuration. + Future updateOAuth2Authentik({String? clientId, String? clientSecret, String? endpoint, bool? enabled}) async { + final String apiPath = '/project/oauth2/authentik'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'endpoint': endpoint, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Authentik.fromMap(res.data); + + } + + /// Update the project OAuth2 Autodesk configuration. + Future updateOAuth2Autodesk({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/autodesk'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Autodesk.fromMap(res.data); + + } + + /// Update the project OAuth2 Bitbucket configuration. + Future updateOAuth2Bitbucket({String? key, String? secret, bool? enabled}) async { + final String apiPath = '/project/oauth2/bitbucket'; + + final Map apiParams = { + + 'key': key, +'secret': secret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Bitbucket.fromMap(res.data); + + } + + /// Update the project OAuth2 Bitly configuration. + Future updateOAuth2Bitly({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/bitly'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Bitly.fromMap(res.data); + + } + + /// Update the project OAuth2 Box configuration. + Future updateOAuth2Box({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/box'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Box.fromMap(res.data); + + } + + /// Update the project OAuth2 Dailymotion configuration. + Future updateOAuth2Dailymotion({String? apiKey, String? apiSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/dailymotion'; + + final Map apiParams = { + + 'apiKey': apiKey, +'apiSecret': apiSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Dailymotion.fromMap(res.data); + + } + + /// Update the project OAuth2 Discord configuration. + Future updateOAuth2Discord({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/discord'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Discord.fromMap(res.data); + + } + + /// Update the project OAuth2 Disqus configuration. + Future updateOAuth2Disqus({String? publicKey, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/disqus'; + + final Map apiParams = { + + 'publicKey': publicKey, +'secretKey': secretKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Disqus.fromMap(res.data); + + } + + /// Update the project OAuth2 Dropbox configuration. + Future updateOAuth2Dropbox({String? appKey, String? appSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/dropbox'; + + final Map apiParams = { + + 'appKey': appKey, +'appSecret': appSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Dropbox.fromMap(res.data); + + } + + /// Update the project OAuth2 Etsy configuration. + Future updateOAuth2Etsy({String? keyString, String? sharedSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/etsy'; + + final Map apiParams = { + + 'keyString': keyString, +'sharedSecret': sharedSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Etsy.fromMap(res.data); + + } + + /// Update the project OAuth2 Facebook configuration. + Future updateOAuth2Facebook({String? appId, String? appSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/facebook'; + + final Map apiParams = { + + 'appId': appId, +'appSecret': appSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Facebook.fromMap(res.data); + + } + + /// Update the project OAuth2 Figma configuration. + Future updateOAuth2Figma({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/figma'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Figma.fromMap(res.data); + + } + + /// Update the project OAuth2 FusionAuth configuration. + Future updateOAuth2FusionAuth({String? clientId, String? clientSecret, String? endpoint, bool? enabled}) async { + final String apiPath = '/project/oauth2/fusionauth'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'endpoint': endpoint, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2FusionAuth.fromMap(res.data); + + } + + /// Update the project OAuth2 GitHub configuration. + Future updateOAuth2GitHub({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/github'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Github.fromMap(res.data); + + } + + /// Update the project OAuth2 Gitlab configuration. + Future updateOAuth2Gitlab({String? applicationId, String? secret, String? endpoint, bool? enabled}) async { + final String apiPath = '/project/oauth2/gitlab'; + + final Map apiParams = { + + 'applicationId': applicationId, +'secret': secret, +'endpoint': endpoint, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Gitlab.fromMap(res.data); + + } + + /// Update the project OAuth2 Google configuration. + Future updateOAuth2Google({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/google'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Google.fromMap(res.data); + + } + + /// Update the project OAuth2 Keycloak configuration. + Future updateOAuth2Keycloak({String? clientId, String? clientSecret, String? endpoint, String? realmName, bool? enabled}) async { + final String apiPath = '/project/oauth2/keycloak'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'endpoint': endpoint, +'realmName': realmName, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Keycloak.fromMap(res.data); + + } + + /// Update the project OAuth2 Kick configuration. + Future updateOAuth2Kick({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/kick'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Kick.fromMap(res.data); + + } + + /// Update the project OAuth2 Linkedin configuration. + Future updateOAuth2Linkedin({String? clientId, String? primaryClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/linkedin'; + + final Map apiParams = { + + 'clientId': clientId, +'primaryClientSecret': primaryClientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Linkedin.fromMap(res.data); + + } + + /// Update the project OAuth2 Microsoft configuration. + Future updateOAuth2Microsoft({String? applicationId, String? applicationSecret, String? tenant, bool? enabled}) async { + final String apiPath = '/project/oauth2/microsoft'; + + final Map apiParams = { + + 'applicationId': applicationId, +'applicationSecret': applicationSecret, +'tenant': tenant, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Microsoft.fromMap(res.data); + + } + + /// Update the project OAuth2 Notion configuration. + Future updateOAuth2Notion({String? oauthClientId, String? oauthClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/notion'; + + final Map apiParams = { + + 'oauthClientId': oauthClientId, +'oauthClientSecret': oauthClientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Notion.fromMap(res.data); + + } + + /// Update the project OAuth2 Oidc configuration. + Future updateOAuth2Oidc({String? clientId, String? clientSecret, String? wellKnownURL, String? authorizationURL, String? tokenURL, String? userInfoURL, bool? enabled}) async { + final String apiPath = '/project/oauth2/oidc'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'wellKnownURL': wellKnownURL, +'authorizationURL': authorizationURL, +'tokenURL': tokenURL, +'userInfoURL': userInfoURL, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Oidc.fromMap(res.data); + + } + + /// Update the project OAuth2 Okta configuration. + Future updateOAuth2Okta({String? clientId, String? clientSecret, String? domain, String? authorizationServerId, bool? enabled}) async { + final String apiPath = '/project/oauth2/okta'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'domain': domain, +'authorizationServerId': authorizationServerId, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Okta.fromMap(res.data); + + } + + /// Update the project OAuth2 Paypal configuration. + Future updateOAuth2Paypal({String? clientId, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/paypal'; + + final Map apiParams = { + + 'clientId': clientId, +'secretKey': secretKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Paypal.fromMap(res.data); + + } + + /// Update the project OAuth2 PaypalSandbox configuration. + Future updateOAuth2PaypalSandbox({String? clientId, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/paypalSandbox'; + + final Map apiParams = { + + 'clientId': clientId, +'secretKey': secretKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Paypal.fromMap(res.data); + + } + + /// Update the project OAuth2 Podio configuration. + Future updateOAuth2Podio({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/podio'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Podio.fromMap(res.data); + + } + + /// Update the project OAuth2 Salesforce configuration. + Future updateOAuth2Salesforce({String? customerKey, String? customerSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/salesforce'; + + final Map apiParams = { + + 'customerKey': customerKey, +'customerSecret': customerSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Salesforce.fromMap(res.data); + + } + + /// Update the project OAuth2 Slack configuration. + Future updateOAuth2Slack({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/slack'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Slack.fromMap(res.data); + + } + + /// Update the project OAuth2 Spotify configuration. + Future updateOAuth2Spotify({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/spotify'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Spotify.fromMap(res.data); + + } + + /// Update the project OAuth2 Stripe configuration. + Future updateOAuth2Stripe({String? clientId, String? apiSecretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/stripe'; + + final Map apiParams = { + + 'clientId': clientId, +'apiSecretKey': apiSecretKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Stripe.fromMap(res.data); + + } + + /// Update the project OAuth2 Tradeshift configuration. + Future updateOAuth2Tradeshift({String? oauth2ClientId, String? oauth2ClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/tradeshift'; + + final Map apiParams = { + + 'oauth2ClientId': oauth2ClientId, +'oauth2ClientSecret': oauth2ClientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Tradeshift.fromMap(res.data); + + } + + /// Update the project OAuth2 Tradeshift Sandbox configuration. + Future updateOAuth2TradeshiftSandbox({String? oauth2ClientId, String? oauth2ClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/tradeshiftBox'; + + final Map apiParams = { + + 'oauth2ClientId': oauth2ClientId, +'oauth2ClientSecret': oauth2ClientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Tradeshift.fromMap(res.data); + + } + + /// Update the project OAuth2 Twitch configuration. + Future updateOAuth2Twitch({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/twitch'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Twitch.fromMap(res.data); + + } + + /// Update the project OAuth2 WordPress configuration. + Future updateOAuth2WordPress({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/wordpress'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2WordPress.fromMap(res.data); + + } + + /// Update the project OAuth2 X configuration. + Future updateOAuth2X({String? customerKey, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/x'; + + final Map apiParams = { + + 'customerKey': customerKey, +'secretKey': secretKey, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2X.fromMap(res.data); + + } + + /// Update the project OAuth2 Yahoo configuration. + Future updateOAuth2Yahoo({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/yahoo'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Yahoo.fromMap(res.data); + + } + + /// Update the project OAuth2 Yandex configuration. + Future updateOAuth2Yandex({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/yandex'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Yandex.fromMap(res.data); + + } + + /// Update the project OAuth2 Zoho configuration. + Future updateOAuth2Zoho({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/zoho'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Zoho.fromMap(res.data); + + } + + /// Update the project OAuth2 Zoom configuration. + Future updateOAuth2Zoom({String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/zoom'; + + final Map apiParams = { + + 'clientId': clientId, +'clientSecret': clientSecret, +'enabled': enabled, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.OAuth2Zoom.fromMap(res.data); + + } + + /// Get a list of all platforms in the project. This endpoint returns an array + /// of all platforms and their configurations. + Future listPlatforms({List? queries, bool? total}) async { + final String apiPath = '/project/platforms'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformList.fromMap(res.data); + + } + + /// Create a new Android platform for your project. Use this endpoint to + /// register a new Android platform where your users will run your application + /// which will interact with the Appwrite API. + Future createAndroidPlatform({required String platformId, required String name, required String applicationId}) async { + final String apiPath = '/project/platforms/android'; + + final Map apiParams = { + + 'platformId': platformId, +'name': name, +'applicationId': applicationId, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformAndroid.fromMap(res.data); + + } + + /// Update an Android platform by its unique ID. Use this endpoint to update + /// the platform's name or application ID. + Future updateAndroidPlatform({required String platformId, required String name, required String applicationId}) async { + final String apiPath = '/project/platforms/android/{platformId}'.replaceAll('{platformId}', platformId); + + final Map apiParams = { + + 'name': name, +'applicationId': applicationId, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformAndroid.fromMap(res.data); + + } + + /// Create a new Apple platform for your project. Use this endpoint to register + /// a new Apple platform where your users will run your application which will + /// interact with the Appwrite API. + Future createApplePlatform({required String platformId, required String name, required String bundleIdentifier}) async { + final String apiPath = '/project/platforms/apple'; + + final Map apiParams = { + + 'platformId': platformId, +'name': name, +'bundleIdentifier': bundleIdentifier, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformApple.fromMap(res.data); + + } + + /// Update an Apple platform by its unique ID. Use this endpoint to update the + /// platform's name or bundle identifier. + Future updateApplePlatform({required String platformId, required String name, required String bundleIdentifier}) async { + final String apiPath = '/project/platforms/apple/{platformId}'.replaceAll('{platformId}', platformId); + + final Map apiParams = { + + 'name': name, +'bundleIdentifier': bundleIdentifier, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformApple.fromMap(res.data); + + } + + /// Create a new Linux platform for your project. Use this endpoint to register + /// a new Linux platform where your users will run your application which will + /// interact with the Appwrite API. + Future createLinuxPlatform({required String platformId, required String name, required String packageName}) async { + final String apiPath = '/project/platforms/linux'; + + final Map apiParams = { + + 'platformId': platformId, +'name': name, +'packageName': packageName, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformLinux.fromMap(res.data); + + } + + /// Update a Linux platform by its unique ID. Use this endpoint to update the + /// platform's name or package name. + Future updateLinuxPlatform({required String platformId, required String name, required String packageName}) async { + final String apiPath = '/project/platforms/linux/{platformId}'.replaceAll('{platformId}', platformId); + + final Map apiParams = { + + 'name': name, +'packageName': packageName, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformLinux.fromMap(res.data); + + } + + /// Create a new web platform for your project. Use this endpoint to register a + /// new platform where your users will run your application which will interact + /// with the Appwrite API. + Future createWebPlatform({required String platformId, required String name, required String hostname}) async { + final String apiPath = '/project/platforms/web'; + + final Map apiParams = { + + 'platformId': platformId, +'name': name, +'hostname': hostname, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformWeb.fromMap(res.data); + + } + + /// Update a web platform by its unique ID. Use this endpoint to update the + /// platform's name or hostname. + Future updateWebPlatform({required String platformId, required String name, required String hostname}) async { + final String apiPath = '/project/platforms/web/{platformId}'.replaceAll('{platformId}', platformId); + + final Map apiParams = { + + 'name': name, +'hostname': hostname, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformWeb.fromMap(res.data); + + } + + /// Create a new Windows platform for your project. Use this endpoint to + /// register a new Windows platform where your users will run your application + /// which will interact with the Appwrite API. + Future createWindowsPlatform({required String platformId, required String name, required String packageIdentifierName}) async { + final String apiPath = '/project/platforms/windows'; + + final Map apiParams = { + + 'platformId': platformId, +'name': name, +'packageIdentifierName': packageIdentifierName, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformWindows.fromMap(res.data); + + } + + /// Update a Windows platform by its unique ID. Use this endpoint to update the + /// platform's name or package identifier name. + Future updateWindowsPlatform({required String platformId, required String name, required String packageIdentifierName}) async { + final String apiPath = '/project/platforms/windows/{platformId}'.replaceAll('{platformId}', platformId); + + final Map apiParams = { + + 'name': name, +'packageIdentifierName': packageIdentifierName, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.PlatformWindows.fromMap(res.data); + + } + + /// Get a platform by its unique ID. This endpoint returns the platform's + /// details, including its name, type, and key configurations. + Future getPlatform({required String platformId}) async { + final String apiPath = '/project/platforms/{platformId}'.replaceAll('{platformId}', platformId); + + final Map apiParams = { + + + }; - final Map apiParams = { - if (queries != null) 'queries': queries, - if (total != null) 'total': total, + final Map apiHeaders = { + }; - final Map apiHeaders = {}; + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + return () { + if (res.data is! Map) { + throw StateError('Unable to match response to any expected response model.'); + } - return models.KeyList.fromMap(res.data); - } + final response = res.data as Map; + if (response['type'] == 'web') { + return models.PlatformWeb.fromMap(response); + } + if (response['type'] == 'apple') { + return models.PlatformApple.fromMap(response); + } + if (response['type'] == 'android') { + return models.PlatformAndroid.fromMap(response); + } + if (response['type'] == 'windows') { + return models.PlatformWindows.fromMap(response); + } + if (response['type'] == 'linux') { + return models.PlatformLinux.fromMap(response); + } - /// Create a new API key. It's recommended to have multiple API keys with - /// strict scopes for separate functions within your project. - Future createKey( - {required String keyId, - required String name, - required List scopes, - String? expire}) async { - final String apiPath = '/project/keys'; + throw StateError('Unable to match response to any expected response model.'); + }(); + + } + + /// Delete a platform by its unique ID. This endpoint removes the platform and + /// all its configurations from the project. + Future deletePlatform({required String platformId}) async { + final String apiPath = '/project/platforms/{platformId}'.replaceAll('{platformId}', platformId); final Map apiParams = { - 'keyId': keyId, - 'name': name, - 'scopes': scopes.map((e) => e.value).toList(), - 'expire': expire, + + }; final Map apiHeaders = { 'content-type': 'application/json', - }; - - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); - - return models.Key.fromMap(res.data); - } - - /// Get a key by its unique ID. - Future getKey({required String keyId}) async { - final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); - final Map apiParams = {}; + }; - final Map apiHeaders = {}; + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + return res.data; - return models.Key.fromMap(res.data); - } + } - /// Update a key by its unique ID. Use this endpoint to update the name, - /// scopes, or expiration time of an API key. - Future updateKey( - {required String keyId, - required String name, - required List scopes, - String? expire}) async { - final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + /// Get a list of all project policies and their current configuration. + Future listPolicies({List? queries, bool? total}) async { + final String apiPath = '/project/policies'; final Map apiParams = { - 'name': name, - 'scopes': scopes.map((e) => e.value).toList(), - 'expire': expire, + if (queries != null) 'queries': queries, +if (total != null) 'total': total, + + }; final Map apiHeaders = { - 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - return models.Key.fromMap(res.data); - } + return models.PolicyList.fromMap(res.data); - /// Delete a key by its unique ID. Once deleted, the key can no longer be used - /// to authenticate API calls. - Future deleteKey({required String keyId}) async { - final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + } + + /// Updating this policy allows you to control if team members can see other + /// members information. When enabled, all team members can see ID, name, + /// email, phone number, and MFA status of other members.. + Future updateMembershipPrivacyPolicy({bool? userId, bool? userEmail, bool? userPhone, bool? userName, bool? userMFA}) async { + final String apiPath = '/project/policies/membership-privacy'; - final Map apiParams = {}; + final Map apiParams = { + + if (userId != null) 'userId': userId, +if (userEmail != null) 'userEmail': userEmail, +if (userPhone != null) 'userPhone': userPhone, +if (userName != null) 'userName': userName, +if (userMFA != null) 'userMFA': userMFA, + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return res.data; - } + return models.Project.fromMap(res.data); - /// Update the project labels. Labels can be used to easily filter projects in - /// an organization. - Future updateLabels({required List labels}) async { - final String apiPath = '/project/labels'; + } + + /// Updating this policy allows you to control if new passwords are checked + /// against most common passwords dictionary. When enabled, and user changes + /// their password, password must not be contained in the dictionary. + Future updatePasswordDictionaryPolicy({required bool enabled}) async { + final String apiPath = '/project/policies/password-dictionary'; final Map apiParams = { - 'labels': labels, + + 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - } - /// Get a list of all platforms in the project. This endpoint returns an array - /// of all platforms and their configurations. - Future listPlatforms( - {List? queries, bool? total}) async { - final String apiPath = '/project/platforms'; + } + + /// Updates one of password strength policies. Based on total length + /// configured, previous password hashes are stored, and users cannot choose a + /// new password that is already stored in the passwird history list, when + /// updating an user password, or setting new one through password recovery. + /// + /// Keep in mind, while password history policy is disabled, the history is not + /// being stored. Enabling the policy will not have any history on existing + /// users, and it will only start to collect and enforce the policy on password + /// changes since the policy is enabled. + Future updatePasswordHistoryPolicy({required int? total}) async { + final String apiPath = '/project/policies/password-history'; final Map apiParams = { - if (queries != null) 'queries': queries, - if (total != null) 'total': total, + + 'total': total, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + }; - final Map apiHeaders = {}; + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + return models.Project.fromMap(res.data); - return models.PlatformList.fromMap(res.data); - } + } - /// Create a new Android platform for your project. Use this endpoint to - /// register a new Android platform where your users will run your application - /// which will interact with the Appwrite API. - Future createAndroidPlatform( - {required String platformId, - required String name, - required String applicationId}) async { - final String apiPath = '/project/platforms/android'; + /// Updating this policy allows you to control if password strength is checked + /// against personal data. When enabled, and user sets or changes their + /// password, the password must not contain user ID, name, email or phone + /// number. + Future updatePasswordPersonalDataPolicy({required bool enabled}) async { + final String apiPath = '/project/policies/password-personal-data'; final Map apiParams = { - 'platformId': platformId, - 'name': name, - 'applicationId': applicationId, + + 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformAndroid.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Update an Android platform by its unique ID. Use this endpoint to update - /// the platform's name or application ID. - Future updateAndroidPlatform( - {required String platformId, - required String name, - required String applicationId}) async { - final String apiPath = '/project/platforms/android/{platformId}' - .replaceAll('{platformId}', platformId); + } + + /// Updating this policy allows you to control if email alert is sent upon + /// session creation. When enabled, and user signs into their account, they + /// will be sent an email notification. There is an exception, the first + /// session after a new sign up does not trigger an alert, even if the policy + /// is enabled. + Future updateSessionAlertPolicy({required bool enabled}) async { + final String apiPath = '/project/policies/session-alert'; final Map apiParams = { - 'name': name, - 'applicationId': applicationId, + + 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformAndroid.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Create a new Apple platform for your project. Use this endpoint to register - /// a new Apple platform where your users will run your application which will - /// interact with the Appwrite API. - Future createApplePlatform( - {required String platformId, - required String name, - required String bundleIdentifier}) async { - final String apiPath = '/project/platforms/apple'; + } + + /// Update maximum duration how long sessions created within a project should + /// stay active for. + Future updateSessionDurationPolicy({required int duration}) async { + final String apiPath = '/project/policies/session-duration'; final Map apiParams = { - 'platformId': platformId, - 'name': name, - 'bundleIdentifier': bundleIdentifier, + + 'duration': duration, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformApple.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Update an Apple platform by its unique ID. Use this endpoint to update the - /// platform's name or bundle identifier. - Future updateApplePlatform( - {required String platformId, - required String name, - required String bundleIdentifier}) async { - final String apiPath = '/project/platforms/apple/{platformId}' - .replaceAll('{platformId}', platformId); + } + + /// Updating this policy allows you to control if existing sessions should be + /// invalidated when a password of a user is changed. When enabled, and user + /// changes their password, they will be logged out of all their devices. + Future updateSessionInvalidationPolicy({required bool enabled}) async { + final String apiPath = '/project/policies/session-invalidation'; final Map apiParams = { - 'name': name, - 'bundleIdentifier': bundleIdentifier, + + 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformApple.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Create a new Linux platform for your project. Use this endpoint to register - /// a new Linux platform where your users will run your application which will - /// interact with the Appwrite API. - Future createLinuxPlatform( - {required String platformId, - required String name, - required String packageName}) async { - final String apiPath = '/project/platforms/linux'; + } + + /// Update the maximum number of sessions allowed per user. When the limit is + /// hit, the oldest session will be deleted to make room for new one. + Future updateSessionLimitPolicy({required int? total}) async { + final String apiPath = '/project/policies/session-limit'; final Map apiParams = { - 'platformId': platformId, - 'name': name, - 'packageName': packageName, + + 'total': total, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformLinux.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Update a Linux platform by its unique ID. Use this endpoint to update the - /// platform's name or package name. - Future updateLinuxPlatform( - {required String platformId, - required String name, - required String packageName}) async { - final String apiPath = '/project/platforms/linux/{platformId}' - .replaceAll('{platformId}', platformId); + } + + /// Update the maximum number of users in the project. When the limit is hit or + /// amount of existing users already exceeded the limit, all users remain + /// active, but new user sign up will be prohibited. + Future updateUserLimitPolicy({required int? total}) async { + final String apiPath = '/project/policies/user-limit'; final Map apiParams = { - 'name': name, - 'packageName': packageName, + + 'total': total, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformLinux.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Create a new web platform for your project. Use this endpoint to register a - /// new platform where your users will run your application which will interact - /// with the Appwrite API. - Future createWebPlatform( - {required String platformId, - required String name, - required String hostname}) async { - final String apiPath = '/project/platforms/web'; + } + + /// Get a policy by its unique ID. This endpoint returns the current + /// configuration for the requested project policy. + Future getPolicy({required enums.PolicyId policyId}) async { + final String apiPath = '/project/policies/{policyId}'.replaceAll('{policyId}', policyId.value); final Map apiParams = { - 'platformId': platformId, - 'name': name, - 'hostname': hostname, + + }; final Map apiHeaders = { - 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformWeb.fromMap(res.data); - } + return () { + if (res.data is! Map) { + throw StateError('Unable to match response to any expected response model.'); + } - /// Update a web platform by its unique ID. Use this endpoint to update the - /// platform's name or hostname. - Future updateWebPlatform( - {required String platformId, - required String name, - required String hostname}) async { - final String apiPath = '/project/platforms/web/{platformId}' - .replaceAll('{platformId}', platformId); + final response = res.data as Map; + if (response['\$id'] == 'password-dictionary') { + return models.PolicyPasswordDictionary.fromMap(response); + } + if (response['\$id'] == 'password-history') { + return models.PolicyPasswordHistory.fromMap(response); + } + if (response['\$id'] == 'password-personal-data') { + return models.PolicyPasswordPersonalData.fromMap(response); + } + if (response['\$id'] == 'session-alert') { + return models.PolicySessionAlert.fromMap(response); + } + if (response['\$id'] == 'session-duration') { + return models.PolicySessionDuration.fromMap(response); + } + if (response['\$id'] == 'session-invalidation') { + return models.PolicySessionInvalidation.fromMap(response); + } + if (response['\$id'] == 'session-limit') { + return models.PolicySessionLimit.fromMap(response); + } + if (response['\$id'] == 'user-limit') { + return models.PolicyUserLimit.fromMap(response); + } + if (response['\$id'] == 'membership-privacy') { + return models.PolicyMembershipPrivacy.fromMap(response); + } + + throw StateError('Unable to match response to any expected response model.'); + }(); + + } + + /// Update properties of a specific protocol. Use this endpoint to enable or + /// disable a protocol in your project. + Future updateProtocol({required enums.ProtocolId protocolId, required bool enabled}) async { + final String apiPath = '/project/protocols/{protocolId}'.replaceAll('{protocolId}', protocolId.value); final Map apiParams = { - 'name': name, - 'hostname': hostname, + + 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformWeb.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Create a new Windows platform for your project. Use this endpoint to - /// register a new Windows platform where your users will run your application - /// which will interact with the Appwrite API. - Future createWindowsPlatform( - {required String platformId, - required String name, - required String packageIdentifierName}) async { - final String apiPath = '/project/platforms/windows'; + } + + /// Update properties of a specific service. Use this endpoint to enable or + /// disable a service in your project. + Future updateService({required enums.ServiceId serviceId, required bool enabled}) async { + final String apiPath = '/project/services/{serviceId}'.replaceAll('{serviceId}', serviceId.value); final Map apiParams = { - 'platformId': platformId, - 'name': name, - 'packageIdentifierName': packageIdentifierName, + + 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformWindows.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Update a Windows platform by its unique ID. Use this endpoint to update the - /// platform's name or package identifier name. - Future updateWindowsPlatform( - {required String platformId, - required String name, - required String packageIdentifierName}) async { - final String apiPath = '/project/platforms/windows/{platformId}' - .replaceAll('{platformId}', platformId); + } + + /// Update the SMTP configuration for your project. Use this endpoint to + /// configure your project's SMTP provider with your custom settings for + /// sending transactional emails. + Future updateSMTP({String? host, int? port, String? username, String? password, String? senderEmail, String? senderName, String? replyToEmail, String? replyToName, enums.Secure? secure, bool? enabled}) async { + final String apiPath = '/project/smtp'; final Map apiParams = { - 'name': name, - 'packageIdentifierName': packageIdentifierName, + + 'host': host, +'port': port, +'username': username, +'password': password, +'senderEmail': senderEmail, +'senderName': senderName, +'replyToEmail': replyToEmail, +'replyToName': replyToName, +'secure': secure?.value, +'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.PlatformWindows.fromMap(res.data); - } + return models.Project.fromMap(res.data); - /// Get a platform by its unique ID. This endpoint returns the platform's - /// details, including its name, type, and key configurations. - Future getPlatform({required String platformId}) async { - final String apiPath = '/project/platforms/{platformId}' - .replaceAll('{platformId}', platformId); + } - final Map apiParams = {}; + /// Send a test email to verify SMTP configuration. + Future createSMTPTest({required List emails}) async { + final String apiPath = '/project/smtp/tests'; - final Map apiHeaders = {}; + final Map apiParams = { + + 'emails': emails, - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + }; - return () { - if (res.data is! Map) { - throw StateError( - 'Unable to match response to any expected response model.'); - } + final Map apiHeaders = { + 'content-type': 'application/json', - final response = res.data as Map; - if (response['type'] == 'web') { - return models.PlatformWeb.fromMap(response); - } - if (response['type'] == 'apple') { - return models.PlatformApple.fromMap(response); - } - if (response['type'] == 'android') { - return models.PlatformAndroid.fromMap(response); - } - if (response['type'] == 'windows') { - return models.PlatformWindows.fromMap(response); - } - if (response['type'] == 'linux') { - return models.PlatformLinux.fromMap(response); - } + }; - throw StateError( - 'Unable to match response to any expected response model.'); - }(); - } + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); - /// Delete a platform by its unique ID. This endpoint removes the platform and - /// all its configurations from the project. - Future deletePlatform({required String platformId}) async { - final String apiPath = '/project/platforms/{platformId}' - .replaceAll('{platformId}', platformId); + return res.data; + + } + + /// Get a list of all custom email templates configured for the project. This + /// endpoint returns an array of all configured email templates and their + /// locales. + Future listEmailTemplates({List? queries, bool? total}) async { + final String apiPath = '/project/templates/email'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, - final Map apiParams = {}; + + }; final Map apiHeaders = { - 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - return res.data; - } + return models.EmailTemplateList.fromMap(res.data); + + } - /// Update the status of a specific protocol. Use this endpoint to enable or - /// disable a protocol in your project. - Future updateProtocolStatus( - {required enums.ProtocolId protocolId, required bool enabled}) async { - final String apiPath = '/project/protocols/{protocolId}/status' - .replaceAll('{protocolId}', protocolId.value); + /// Update a custom email template for the specified locale and type. Use this + /// endpoint to modify the content of your email templates. + Future updateEmailTemplate({required enums.EmailTemplateType templateId, enums.EmailTemplateLocale? locale, String? subject, String? message, String? senderName, String? senderEmail, String? replyToEmail, String? replyToName}) async { + final String apiPath = '/project/templates/email'; final Map apiParams = { - 'enabled': enabled, + + 'templateId': templateId.value, +if (locale != null) 'locale': locale.value, +'subject': subject, +'message': message, +'senderName': senderName, +'senderEmail': senderEmail, +'replyToEmail': replyToEmail, +'replyToName': replyToName, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); - return models.Project.fromMap(res.data); - } + return models.EmailTemplate.fromMap(res.data); - /// Update the status of a specific service. Use this endpoint to enable or - /// disable a service in your project. - Future updateServiceStatus( - {required enums.ServiceId serviceId, required bool enabled}) async { - final String apiPath = '/project/services/{serviceId}/status' - .replaceAll('{serviceId}', serviceId.value); + } + + /// Get a custom email template for the specified locale and type. This + /// endpoint returns the template content, subject, and other configuration + /// details. + Future getEmailTemplate({required enums.EmailTemplateType templateId, enums.EmailTemplateLocale? locale}) async { + final String apiPath = '/project/templates/email/{templateId}'.replaceAll('{templateId}', templateId.value); final Map apiParams = { - 'enabled': enabled, + if (locale != null) 'locale': locale.value, + + }; final Map apiHeaders = { - 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); - return models.Project.fromMap(res.data); - } + return models.EmailTemplate.fromMap(res.data); + + } /// Get a list of all project environment variables. - Future listVariables( - {List? queries, bool? total}) async { - final String apiPath = '/project/variables'; + Future listVariables({List? queries, bool? total}) async { + final String apiPath = '/project/variables'; final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.VariableList.fromMap(res.data); - } + + } /// Create a new project environment variable. These variables can be accessed /// by all functions and sites in the project. - Future createVariable( - {required String variableId, - required String key, - required String value, - bool? secret}) async { - final String apiPath = '/project/variables'; + Future createVariable({required String variableId, required String key, required String value, bool? secret}) async { + final String apiPath = '/project/variables'; final Map apiParams = { + 'variableId': variableId, - 'key': key, - 'value': value, - if (secret != null) 'secret': secret, +'key': key, +'value': value, +if (secret != null) 'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } - /// Get a variable by its unique ID. - Future getVariable({required String variableId}) async { - final String apiPath = '/project/variables/{variableId}' - .replaceAll('{variableId}', variableId); + } + + /// Get a variable by its unique ID. + Future getVariable({required String variableId}) async { + final String apiPath = '/project/variables/{variableId}'.replaceAll('{variableId}', variableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Update variable by its unique ID. - Future updateVariable( - {required String variableId, - String? key, - String? value, - bool? secret}) async { - final String apiPath = '/project/variables/{variableId}' - .replaceAll('{variableId}', variableId); + Future updateVariable({required String variableId, String? key, String? value, bool? secret}) async { + final String apiPath = '/project/variables/{variableId}'.replaceAll('{variableId}', variableId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } - /// Delete a variable by its unique ID. - Future deleteVariable({required String variableId}) async { - final String apiPath = '/project/variables/{variableId}' - .replaceAll('{variableId}', variableId); + } + + /// Delete a variable by its unique ID. + Future deleteVariable({required String variableId}) async { + final String apiPath = '/project/variables/{variableId}'.replaceAll('{variableId}', variableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/proxy.dart b/lib/services/proxy.dart new file mode 100644 index 00000000..1871d56a --- /dev/null +++ b/lib/services/proxy.dart @@ -0,0 +1,196 @@ +part of '../dart_appwrite.dart'; + + /// The Proxy Service allows you to configure actions for your domains beyond + /// DNS configuration. +class Proxy extends Service { + Proxy(super.client); + + /// Get a list of all the proxy rules. You can use the query params to filter + /// your results. + Future listRules({List? queries, bool? total}) async { + final String apiPath = '/proxy/rules'; + + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRuleList.fromMap(res.data); + + } + + /// Create a new proxy rule for serving Appwrite's API on custom domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createAPIRule({required String domain}) async { + final String apiPath = '/proxy/rules/api'; + + final Map apiParams = { + + 'domain': domain, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + + } + + /// Create a new proxy rule for executing Appwrite Function on custom domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createFunctionRule({required String domain, required String functionId, String? branch}) async { + final String apiPath = '/proxy/rules/function'; + + final Map apiParams = { + + 'domain': domain, +'functionId': functionId, +if (branch != null) 'branch': branch, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + + } + + /// Create a new proxy rule for to redirect from custom domain to another + /// domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createRedirectRule({required String domain, required String url, required enums.StatusCode statusCode, required String resourceId, required enums.ProxyResourceType resourceType}) async { + final String apiPath = '/proxy/rules/redirect'; + + final Map apiParams = { + + 'domain': domain, +'url': url, +'statusCode': statusCode.value, +'resourceId': resourceId, +'resourceType': resourceType.value, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + + } + + /// Create a new proxy rule for serving Appwrite Site on custom domain. + /// + /// Rule ID is automatically generated as MD5 hash of a rule domain for + /// performance purposes. + Future createSiteRule({required String domain, required String siteId, String? branch}) async { + final String apiPath = '/proxy/rules/site'; + + final Map apiParams = { + + 'domain': domain, +'siteId': siteId, +if (branch != null) 'branch': branch, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + + } + + /// Get a proxy rule by its unique ID. + Future getRule({required String ruleId}) async { + final String apiPath = '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + + } + + /// Delete a proxy rule by its unique ID. + Future deleteRule({required String ruleId}) async { + final String apiPath = '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + + return res.data; + + } + + /// If not succeeded yet, retry verification process of a proxy rule domain. + /// This endpoint triggers domain verification by checking DNS records. If + /// verification is successful, a TLS certificate will be automatically + /// provisioned for the domain asynchronously in the background. + Future updateRuleStatus({required String ruleId}) async { + final String apiPath = '/proxy/rules/{ruleId}/status'.replaceAll('{ruleId}', ruleId); + + final Map apiParams = { + + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ProxyRule.fromMap(res.data); + + } +} diff --git a/lib/services/sites.dart b/lib/services/sites.dart index 80bd96f0..31b857a9 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,282 +1,255 @@ part of '../dart_appwrite.dart'; -/// The Sites Service allows you view, create and manage your web applications. + /// The Sites Service allows you view, create and manage your web applications. class Sites extends Service { - Sites(super.client); + Sites(super.client); /// Get a list of all the project's sites. You can use the query params to /// filter your results. - Future list( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/sites'; + Future list({List? queries, String? search, bool? total}) async { + final String apiPath = '/sites'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.SiteList.fromMap(res.data); - } + + } /// Create a new site. - Future create( - {required String siteId, - required String name, - required enums.Framework framework, - required enums.BuildRuntime buildRuntime, - bool? enabled, - bool? logging, - int? timeout, - String? installCommand, - String? buildCommand, - String? startCommand, - String? outputDirectory, - enums.Adapter? adapter, - String? installationId, - String? fallbackFile, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? buildSpecification, - String? runtimeSpecification, - int? deploymentRetention}) async { - final String apiPath = '/sites'; + Future create({required String siteId, required String name, required enums.Framework framework, required enums.BuildRuntime buildRuntime, bool? enabled, bool? logging, int? timeout, String? installCommand, String? buildCommand, String? startCommand, String? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { + final String apiPath = '/sites'; final Map apiParams = { + 'siteId': siteId, - 'name': name, - 'framework': framework.value, - if (enabled != null) 'enabled': enabled, - if (logging != null) 'logging': logging, - if (timeout != null) 'timeout': timeout, - if (installCommand != null) 'installCommand': installCommand, - if (buildCommand != null) 'buildCommand': buildCommand, - if (startCommand != null) 'startCommand': startCommand, - if (outputDirectory != null) 'outputDirectory': outputDirectory, - 'buildRuntime': buildRuntime.value, - if (adapter != null) 'adapter': adapter.value, - if (installationId != null) 'installationId': installationId, - if (fallbackFile != null) 'fallbackFile': fallbackFile, - if (providerRepositoryId != null) - 'providerRepositoryId': providerRepositoryId, - if (providerBranch != null) 'providerBranch': providerBranch, - if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, - if (providerRootDirectory != null) - 'providerRootDirectory': providerRootDirectory, - if (buildSpecification != null) 'buildSpecification': buildSpecification, - if (runtimeSpecification != null) - 'runtimeSpecification': runtimeSpecification, - if (deploymentRetention != null) - 'deploymentRetention': deploymentRetention, +'name': name, +'framework': framework.value, +if (enabled != null) 'enabled': enabled, +if (logging != null) 'logging': logging, +if (timeout != null) 'timeout': timeout, +if (installCommand != null) 'installCommand': installCommand, +if (buildCommand != null) 'buildCommand': buildCommand, +if (startCommand != null) 'startCommand': startCommand, +if (outputDirectory != null) 'outputDirectory': outputDirectory, +'buildRuntime': buildRuntime.value, +if (adapter != null) 'adapter': adapter.value, +if (installationId != null) 'installationId': installationId, +if (fallbackFile != null) 'fallbackFile': fallbackFile, +if (providerRepositoryId != null) 'providerRepositoryId': providerRepositoryId, +if (providerBranch != null) 'providerBranch': providerBranch, +if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, +if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, +if (buildSpecification != null) 'buildSpecification': buildSpecification, +if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, +if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - } + + } /// Get a list of all frameworks that are currently available on the server /// instance. - Future listFrameworks() async { - final String apiPath = '/sites/frameworks'; + Future listFrameworks() async { + final String apiPath = '/sites/frameworks'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.FrameworkList.fromMap(res.data); - } + + } /// List allowed site specifications for this instance. - Future listSpecifications() async { - final String apiPath = '/sites/specifications'; + Future listSpecifications() async { + final String apiPath = '/sites/specifications'; - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.SpecificationList.fromMap(res.data); - } + + } /// Get a site by its unique ID. - Future get({required String siteId}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + Future get({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - } + + } /// Update site by its unique ID. - Future update( - {required String siteId, - required String name, - required enums.Framework framework, - bool? enabled, - bool? logging, - int? timeout, - String? installCommand, - String? buildCommand, - String? startCommand, - String? outputDirectory, - enums.BuildRuntime? buildRuntime, - enums.Adapter? adapter, - String? fallbackFile, - String? installationId, - String? providerRepositoryId, - String? providerBranch, - bool? providerSilentMode, - String? providerRootDirectory, - String? buildSpecification, - String? runtimeSpecification, - int? deploymentRetention}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + Future update({required String siteId, required String name, required enums.Framework framework, bool? enabled, bool? logging, int? timeout, String? installCommand, String? buildCommand, String? startCommand, String? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'name': name, - 'framework': framework.value, - if (enabled != null) 'enabled': enabled, - if (logging != null) 'logging': logging, - if (timeout != null) 'timeout': timeout, - if (installCommand != null) 'installCommand': installCommand, - if (buildCommand != null) 'buildCommand': buildCommand, - if (startCommand != null) 'startCommand': startCommand, - if (outputDirectory != null) 'outputDirectory': outputDirectory, - if (buildRuntime != null) 'buildRuntime': buildRuntime.value, - if (adapter != null) 'adapter': adapter.value, - if (fallbackFile != null) 'fallbackFile': fallbackFile, - if (installationId != null) 'installationId': installationId, - if (providerRepositoryId != null) - 'providerRepositoryId': providerRepositoryId, - if (providerBranch != null) 'providerBranch': providerBranch, - if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, - if (providerRootDirectory != null) - 'providerRootDirectory': providerRootDirectory, - if (buildSpecification != null) 'buildSpecification': buildSpecification, - if (runtimeSpecification != null) - 'runtimeSpecification': runtimeSpecification, - if (deploymentRetention != null) - 'deploymentRetention': deploymentRetention, +'framework': framework.value, +if (enabled != null) 'enabled': enabled, +if (logging != null) 'logging': logging, +if (timeout != null) 'timeout': timeout, +if (installCommand != null) 'installCommand': installCommand, +if (buildCommand != null) 'buildCommand': buildCommand, +if (startCommand != null) 'startCommand': startCommand, +if (outputDirectory != null) 'outputDirectory': outputDirectory, +if (buildRuntime != null) 'buildRuntime': buildRuntime.value, +if (adapter != null) 'adapter': adapter.value, +if (fallbackFile != null) 'fallbackFile': fallbackFile, +if (installationId != null) 'installationId': installationId, +if (providerRepositoryId != null) 'providerRepositoryId': providerRepositoryId, +if (providerBranch != null) 'providerBranch': providerBranch, +if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, +if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, +if (buildSpecification != null) 'buildSpecification': buildSpecification, +if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, +if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - } + + } /// Delete a site by its unique ID. - Future delete({required String siteId}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Update the site active deployment. Use this endpoint to switch the code /// deployment that should be used when visitor opens your site. - Future updateSiteDeployment( - {required String siteId, required String deploymentId}) async { - final String apiPath = - '/sites/{siteId}/deployment'.replaceAll('{siteId}', siteId); + Future updateSiteDeployment({required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployment'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'deploymentId': deploymentId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - } + + } /// Get a list of all the site's code deployments. You can use the query params /// to filter your results. - Future listDeployments( - {required String siteId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = - '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments({required String siteId, List? queries, String? search, bool? total}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.DeploymentList.fromMap(res.data); - } + + } /// Create a new site code deployment. Use this endpoint to upload a new /// version of your site code. To activate your newly uploaded code, you'll /// need to update the site's deployment to use your new deployment ID. - Future createDeployment( - {required String siteId, - required InputFile code, - String? installCommand, - String? buildCommand, - String? outputDirectory, - bool? activate, - Function(UploadProgress)? onProgress}) async { - final String apiPath = - '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment({required String siteId, required InputFile code, String? installCommand, String? buildCommand, String? outputDirectory, bool? activate, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { + if (installCommand != null) 'installCommand': installCommand, - if (buildCommand != null) 'buildCommand': buildCommand, - if (outputDirectory != null) 'outputDirectory': outputDirectory, - 'code': code, - if (activate != null) 'activate': activate, +if (buildCommand != null) 'buildCommand': buildCommand, +if (outputDirectory != null) 'outputDirectory': outputDirectory, +'code': code, +if (activate != null) 'activate': activate, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -291,331 +264,336 @@ class Sites extends Service { ); return models.Deployment.fromMap(res.data); - } + + } /// Create a new build for an existing site deployment. This endpoint allows /// you to rebuild a deployment with the updated site configuration, including /// its commands and output directory if they have been modified. The build /// process will be queued and executed asynchronously. The original /// deployment's code will be preserved and used for the new build. - Future createDuplicateDeployment( - {required String siteId, required String deploymentId}) async { - final String apiPath = - '/sites/{siteId}/deployments/duplicate'.replaceAll('{siteId}', siteId); + Future createDuplicateDeployment({required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/duplicate'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'deploymentId': deploymentId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Create a deployment based on a template. - /// + /// /// Use this endpoint with combination of /// [listTemplates](https://appwrite.io/docs/products/sites/templates) to find /// the template details. - Future createTemplateDeployment( - {required String siteId, - required String repository, - required String owner, - required String rootDirectory, - required enums.TemplateReferenceType type, - required String reference, - bool? activate}) async { - final String apiPath = - '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); + Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required enums.TemplateReferenceType type, required String reference, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'repository': repository, - 'owner': owner, - 'rootDirectory': rootDirectory, - 'type': type.value, - 'reference': reference, - if (activate != null) 'activate': activate, +'owner': owner, +'rootDirectory': rootDirectory, +'type': type.value, +'reference': reference, +if (activate != null) 'activate': activate, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Create a deployment when a site is connected to VCS. - /// + /// /// This endpoint lets you create deployment from a branch, commit, or a tag. - Future createVcsDeployment( - {required String siteId, - required enums.VCSReferenceType type, - required String reference, - bool? activate}) async { - final String apiPath = - '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment({required String siteId, required enums.VCSReferenceType type, required String reference, bool? activate}) async { + final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); final Map apiParams = { + 'type': type.value, - 'reference': reference, - if (activate != null) 'activate': activate, +'reference': reference, +if (activate != null) 'activate': activate, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Get a site deployment by its unique ID. - Future getDeployment( - {required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{deploymentId}', deploymentId); + Future getDeployment({required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Delete a site deployment by its unique ID. - Future deleteDeployment( - {required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{deploymentId}', deploymentId); + Future deleteDeployment({required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a site deployment content by its unique ID. The endpoint response /// return with a 'Content-Disposition: attachment' header that tells the /// browser to start downloading the file to user downloads directory. - Future getDeploymentDownload( - {required String siteId, - required String deploymentId, - enums.DeploymentDownloadType? type}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/download' - .replaceAll('{siteId}', siteId) - .replaceAll('{deploymentId}', deploymentId); + Future getDeploymentDownload({required String siteId, required String deploymentId, enums.DeploymentDownloadType? type}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); final Map params = { if (type != null) 'type': type.value, + + 'project': client.config['project'], 'key': client.config['key'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Cancel an ongoing site deployment build. If the build is already in /// progress, it will be stopped and marked as canceled. If the build hasn't /// started yet, it will be marked as canceled without executing. You cannot /// cancel builds that have already completed (status 'ready') or failed. The /// response includes the final build status and details. - Future updateDeploymentStatus( - {required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/status' - .replaceAll('{siteId}', siteId) - .replaceAll('{deploymentId}', deploymentId); + Future updateDeploymentStatus({required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - } + + } /// Get a list of all site logs. You can use the query params to filter your /// results. - Future listLogs( - {required String siteId, List? queries, bool? total}) async { - final String apiPath = - '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); + Future listLogs({required String siteId, List? queries, bool? total}) async { + final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ExecutionList.fromMap(res.data); - } + + } /// Get a site request log by its unique ID. - Future getLog( - {required String siteId, required String logId}) async { - final String apiPath = '/sites/{siteId}/logs/{logId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{logId}', logId); + Future getLog({required String siteId, required String logId}) async { + final String apiPath = '/sites/{siteId}/logs/{logId}'.replaceAll('{siteId}', siteId).replaceAll('{logId}', logId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Execution.fromMap(res.data); - } + + } /// Delete a site log by its unique ID. - Future deleteLog({required String siteId, required String logId}) async { - final String apiPath = '/sites/{siteId}/logs/{logId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{logId}', logId); + Future deleteLog({required String siteId, required String logId}) async { + final String apiPath = '/sites/{siteId}/logs/{logId}'.replaceAll('{siteId}', siteId).replaceAll('{logId}', logId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all variables of a specific site. - Future listVariables({required String siteId}) async { - final String apiPath = - '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); + Future listVariables({required String siteId, List? queries, bool? total}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); - final Map apiParams = {}; + final Map apiParams = { + if (queries != null) 'queries': queries, +if (total != null) 'total': total, - final Map apiHeaders = {}; + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final Map apiHeaders = { + + }; + + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.VariableList.fromMap(res.data); - } + + } /// Create a new site variable. These variables can be accessed during build /// and runtime (server-side rendering) as environment variables. - Future createVariable( - {required String siteId, - required String key, - required String value, - bool? secret}) async { - final String apiPath = - '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); + Future createVariable({required String siteId, required String variableId, required String key, required String value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'key': key, - 'value': value, - if (secret != null) 'secret': secret, + + 'variableId': variableId, +'key': key, +'value': value, +if (secret != null) 'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Get a variable by its unique ID. - Future getVariable( - {required String siteId, required String variableId}) async { - final String apiPath = '/sites/{siteId}/variables/{variableId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{variableId}', variableId); + Future getVariable({required String siteId, required String variableId}) async { + final String apiPath = '/sites/{siteId}/variables/{variableId}'.replaceAll('{siteId}', siteId).replaceAll('{variableId}', variableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Update variable by its unique ID. - Future updateVariable( - {required String siteId, - required String variableId, - required String key, - String? value, - bool? secret}) async { - final String apiPath = '/sites/{siteId}/variables/{variableId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{variableId}', variableId); + Future updateVariable({required String siteId, required String variableId, String? key, String? value, bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables/{variableId}'.replaceAll('{siteId}', siteId).replaceAll('{variableId}', variableId); final Map apiParams = { + 'key': key, - 'value': value, - 'secret': secret, +'value': value, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - } + + } /// Delete a variable by its unique ID. - Future deleteVariable( - {required String siteId, required String variableId}) async { - final String apiPath = '/sites/{siteId}/variables/{variableId}' - .replaceAll('{siteId}', siteId) - .replaceAll('{variableId}', variableId); + Future deleteVariable({required String siteId, required String variableId}) async { + final String apiPath = '/sites/{siteId}/variables/{variableId}'.replaceAll('{siteId}', siteId).replaceAll('{variableId}', variableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/storage.dart b/lib/services/storage.dart index 03fd7053..b01e9afb 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,201 +1,188 @@ part of '../dart_appwrite.dart'; -/// The Storage service allows you to manage your project files. + /// The Storage service allows you to manage your project files. class Storage extends Service { - Storage(super.client); + Storage(super.client); /// Get a list of all the storage buckets. You can use the query params to /// filter your results. - Future listBuckets( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets({List? queries, String? search, bool? total}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.BucketList.fromMap(res.data); - } + + } /// Create a new storage bucket. - Future createBucket( - {required String bucketId, - required String name, - List? permissions, - bool? fileSecurity, - bool? enabled, - int? maximumFileSize, - List? allowedFileExtensions, - enums.Compression? compression, - bool? encryption, - bool? antivirus, - bool? transformations}) async { - final String apiPath = '/storage/buckets'; + Future createBucket({required String bucketId, required String name, List? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List? allowedFileExtensions, enums.Compression? compression, bool? encryption, bool? antivirus, bool? transformations}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { + 'bucketId': bucketId, - 'name': name, - 'permissions': permissions, - if (fileSecurity != null) 'fileSecurity': fileSecurity, - if (enabled != null) 'enabled': enabled, - if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, - if (allowedFileExtensions != null) - 'allowedFileExtensions': allowedFileExtensions, - if (compression != null) 'compression': compression.value, - if (encryption != null) 'encryption': encryption, - if (antivirus != null) 'antivirus': antivirus, - if (transformations != null) 'transformations': transformations, +'name': name, +'permissions': permissions, +if (fileSecurity != null) 'fileSecurity': fileSecurity, +if (enabled != null) 'enabled': enabled, +if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, +if (allowedFileExtensions != null) 'allowedFileExtensions': allowedFileExtensions, +if (compression != null) 'compression': compression.value, +if (encryption != null) 'encryption': encryption, +if (antivirus != null) 'antivirus': antivirus, +if (transformations != null) 'transformations': transformations, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Bucket.fromMap(res.data); - } + + } /// Get a storage bucket by its unique ID. This endpoint response returns a /// JSON object with the storage bucket metadata. - Future getBucket({required String bucketId}) async { - final String apiPath = - '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + Future getBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Bucket.fromMap(res.data); - } + + } /// Update a storage bucket by its unique ID. - Future updateBucket( - {required String bucketId, - required String name, - List? permissions, - bool? fileSecurity, - bool? enabled, - int? maximumFileSize, - List? allowedFileExtensions, - enums.Compression? compression, - bool? encryption, - bool? antivirus, - bool? transformations}) async { - final String apiPath = - '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + Future updateBucket({required String bucketId, required String name, List? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List? allowedFileExtensions, enums.Compression? compression, bool? encryption, bool? antivirus, bool? transformations}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'name': name, - 'permissions': permissions, - if (fileSecurity != null) 'fileSecurity': fileSecurity, - if (enabled != null) 'enabled': enabled, - if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, - if (allowedFileExtensions != null) - 'allowedFileExtensions': allowedFileExtensions, - if (compression != null) 'compression': compression.value, - if (encryption != null) 'encryption': encryption, - if (antivirus != null) 'antivirus': antivirus, - if (transformations != null) 'transformations': transformations, +'permissions': permissions, +if (fileSecurity != null) 'fileSecurity': fileSecurity, +if (enabled != null) 'enabled': enabled, +if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, +if (allowedFileExtensions != null) 'allowedFileExtensions': allowedFileExtensions, +if (compression != null) 'compression': compression.value, +if (encryption != null) 'encryption': encryption, +if (antivirus != null) 'antivirus': antivirus, +if (transformations != null) 'transformations': transformations, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Bucket.fromMap(res.data); - } + + } /// Delete a storage bucket by its unique ID. - Future deleteBucket({required String bucketId}) async { - final String apiPath = - '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + Future deleteBucket({required String bucketId}) async { + final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all the user files. You can use the query params to filter /// your results. - Future listFiles( - {required String bucketId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = - '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles({required String bucketId, List? queries, String? search, bool? total}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.FileList.fromMap(res.data); - } + + } /// Create a new file. Before using this route, you should create a new bucket /// resource using either a [server /// integration](https://appwrite.io/docs/server/storage#storageCreateBucket) /// API or directly from your Appwrite console. - /// + /// /// Larger files should be uploaded using multiple requests with the /// [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) /// header to send a partial request with a maximum supported chunk of `5MB`. /// The `content-range` header values should always be in bytes. - /// + /// /// When the first request is sent, the server will return the **File** object, /// and the subsequent part request must include the file's **id** in /// `x-appwrite-id` header to allow the server to know that the partial upload /// is for the existing file and not for a new one. - /// + /// /// If you're creating a new file using one of the Appwrite SDKs, all the /// chunking logic will be managed by the SDK internally. - /// - Future createFile( - {required String bucketId, - required String fileId, - required InputFile file, - List? permissions, - Function(UploadProgress)? onProgress}) async { - final String apiPath = - '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + /// + Future createFile({required String bucketId, required String fileId, required InputFile file, List? permissions, Function(UploadProgress)? onProgress}) async { + final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { + 'fileId': fileId, - 'file': file, - if (permissions != null) 'permissions': permissions, +'file': file, +if (permissions != null) 'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'multipart/form-data', + }; String idParamName = ''; @@ -211,154 +198,137 @@ class Storage extends Service { ); return models.File.fromMap(res.data); - } + + } /// Get a file by its unique ID. This endpoint response returns a JSON object /// with the file metadata. - Future getFile( - {required String bucketId, required String fileId}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future getFile({required String bucketId, required String fileId}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.File.fromMap(res.data); - } + + } /// Update a file by its unique ID. Only users with write permissions have /// access to update this resource. - Future updateFile( - {required String bucketId, - required String fileId, - String? name, - List? permissions}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future updateFile({required String bucketId, required String fileId, String? name, List? permissions}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map apiParams = { + if (name != null) 'name': name, - 'permissions': permissions, +'permissions': permissions, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.File.fromMap(res.data); - } + + } /// Delete a file by its unique ID. Only users with write permissions have /// access to delete this resource. - Future deleteFile({required String bucketId, required String fileId}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future deleteFile({required String bucketId, required String fileId}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a file content by its unique ID. The endpoint response return with a /// 'Content-Disposition: attachment' header that tells the browser to start /// downloading the file to user downloads directory. - Future getFileDownload( - {required String bucketId, required String fileId, String? token}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future getFileDownload({required String bucketId, required String fileId, String? token}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map params = { if (token != null) 'token': token, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Get a file preview image. Currently, this method supports preview for image /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, /// and spreadsheets, will return the file icon image. You can also pass query /// string arguments for cutting and resizing your preview image. Preview is /// supported only for image files smaller than 10MB. - Future getFilePreview( - {required String bucketId, - required String fileId, - int? width, - int? height, - enums.ImageGravity? gravity, - int? quality, - int? borderWidth, - String? borderColor, - int? borderRadius, - double? opacity, - int? rotation, - String? background, - enums.ImageFormat? output, - String? token}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future getFilePreview({required String bucketId, required String fileId, int? width, int? height, enums.ImageGravity? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, enums.ImageFormat? output, String? token}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map params = { if (width != null) 'width': width, - if (height != null) 'height': height, - if (gravity != null) 'gravity': gravity.value, - if (quality != null) 'quality': quality, - if (borderWidth != null) 'borderWidth': borderWidth, - if (borderColor != null) 'borderColor': borderColor, - if (borderRadius != null) 'borderRadius': borderRadius, - if (opacity != null) 'opacity': opacity, - if (rotation != null) 'rotation': rotation, - if (background != null) 'background': background, - if (output != null) 'output': output.value, - if (token != null) 'token': token, +if (height != null) 'height': height, +if (gravity != null) 'gravity': gravity.value, +if (quality != null) 'quality': quality, +if (borderWidth != null) 'borderWidth': borderWidth, +if (borderColor != null) 'borderColor': borderColor, +if (borderRadius != null) 'borderRadius': borderRadius, +if (opacity != null) 'opacity': opacity, +if (rotation != null) 'rotation': rotation, +if (background != null) 'background': background, +if (output != null) 'output': output.value, +if (token != null) 'token': token, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Get a file content by its unique ID. This endpoint is similar to the /// download method but returns with no 'Content-Disposition: attachment' /// header. - Future getFileView( - {required String bucketId, required String fileId, String? token}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future getFileView({required String bucketId, required String fileId, String? token}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map params = { if (token != null) 'token': token, + + 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } } diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index 384b3804..ec1d10c5 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1459 +1,1293 @@ part of '../dart_appwrite.dart'; class TablesDB extends Service { - TablesDB(super.client); + TablesDB(super.client); /// Get a list of all databases from the current Appwrite project. You can use /// the search parameter to filter your results. - Future list( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/tablesdb'; + Future list({List? queries, String? search, bool? total}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.DatabaseList.fromMap(res.data); - } + + } /// Create a new Database. - /// - Future create( - {required String databaseId, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb'; + /// + Future create({required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { + 'databaseId': databaseId, - 'name': name, - if (enabled != null) 'enabled': enabled, +'name': name, +if (enabled != null) 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - } + + } /// List transactions across all databases. - Future listTransactions( - {List? queries}) async { - final String apiPath = '/tablesdb/transactions'; + Future listTransactions({List? queries}) async { + final String apiPath = '/tablesdb/transactions'; final Map apiParams = { if (queries != null) 'queries': queries, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TransactionList.fromMap(res.data); - } + + } /// Create a new transaction. - Future createTransaction({int? ttl}) async { - final String apiPath = '/tablesdb/transactions'; + Future createTransaction({int? ttl}) async { + final String apiPath = '/tablesdb/transactions'; final Map apiParams = { + if (ttl != null) 'ttl': ttl, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Get a transaction by its unique ID. - Future getTransaction( - {required String transactionId}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}' - .replaceAll('{transactionId}', transactionId); + Future getTransaction({required String transactionId}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Update a transaction, to either commit or roll back its operations. - Future updateTransaction( - {required String transactionId, bool? commit, bool? rollback}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}' - .replaceAll('{transactionId}', transactionId); + Future updateTransaction({required String transactionId, bool? commit, bool? rollback}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); final Map apiParams = { + if (commit != null) 'commit': commit, - if (rollback != null) 'rollback': rollback, +if (rollback != null) 'rollback': rollback, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Delete a transaction by its unique ID. - Future deleteTransaction({required String transactionId}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}' - .replaceAll('{transactionId}', transactionId); + Future deleteTransaction({required String transactionId}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Create multiple operations in a single transaction. - Future createOperations( - {required String transactionId, List? operations}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}/operations' - .replaceAll('{transactionId}', transactionId); + Future createOperations({required String transactionId, List? operations}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}/operations'.replaceAll('{transactionId}', transactionId); final Map apiParams = { + if (operations != null) 'operations': operations, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - } + + } /// Get a database by its unique ID. This endpoint response returns a JSON /// object with the database metadata. - Future get({required String databaseId}) async { - final String apiPath = - '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + Future get({required String databaseId}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - } + + } /// Update a database by its unique ID. - Future update( - {required String databaseId, String? name, bool? enabled}) async { - final String apiPath = - '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + Future update({required String databaseId, String? name, bool? enabled}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + if (name != null) 'name': name, - if (enabled != null) 'enabled': enabled, +if (enabled != null) 'enabled': enabled, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - } + + } /// Delete a database by its unique ID. Only API keys with with databases.write /// scope can delete a database. - Future delete({required String databaseId}) async { - final String apiPath = - '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + Future delete({required String databaseId}) async { + final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all tables that belong to the provided databaseId. You can /// use the search parameter to filter your results. - Future listTables( - {required String databaseId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables({required String databaseId, List? queries, String? search, bool? total}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TableList.fromMap(res.data); - } + + } /// Create a new Table. Before using this route, you should create a new /// database resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future createTable( - {required String databaseId, - required String tableId, - required String name, - List? permissions, - bool? rowSecurity, - bool? enabled, - List? columns, - List? indexes}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled, List? columns, List? indexes}) async { + final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { + 'tableId': tableId, - 'name': name, - 'permissions': permissions, - if (rowSecurity != null) 'rowSecurity': rowSecurity, - if (enabled != null) 'enabled': enabled, - if (columns != null) 'columns': columns, - if (indexes != null) 'indexes': indexes, +'name': name, +'permissions': permissions, +if (rowSecurity != null) 'rowSecurity': rowSecurity, +if (enabled != null) 'enabled': enabled, +if (columns != null) 'columns': columns, +if (indexes != null) 'indexes': indexes, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Table.fromMap(res.data); - } + + } /// Get a table by its unique ID. This endpoint response returns a JSON object /// with the table metadata. - Future getTable( - {required String databaseId, required String tableId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future getTable({required String databaseId, required String tableId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Table.fromMap(res.data); - } + + } /// Update a table by its unique ID. - Future updateTable( - {required String databaseId, - required String tableId, - String? name, - List? permissions, - bool? rowSecurity, - bool? enabled, - bool? purge}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateTable({required String databaseId, required String tableId, String? name, List? permissions, bool? rowSecurity, bool? enabled, bool? purge}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + if (name != null) 'name': name, - 'permissions': permissions, - if (rowSecurity != null) 'rowSecurity': rowSecurity, - if (enabled != null) 'enabled': enabled, - if (purge != null) 'purge': purge, +'permissions': permissions, +if (rowSecurity != null) 'rowSecurity': rowSecurity, +if (enabled != null) 'enabled': enabled, +if (purge != null) 'purge': purge, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Table.fromMap(res.data); - } + + } /// Delete a table by its unique ID. Only users with write permissions have /// access to delete this resource. - Future deleteTable( - {required String databaseId, required String tableId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future deleteTable({required String databaseId, required String tableId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// List columns in the table. - Future listColumns( - {required String databaseId, - required String tableId, - List? queries, - bool? total}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future listColumns({required String databaseId, required String tableId, List? queries, bool? total}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnList.fromMap(res.data); - } - /// Create a boolean column. - /// - Future createBooleanColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - bool? xdefault, - bool? array}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + } + + /// Create a bigint column. Optionally, minimum and maximum values can be + /// provided. + /// + Future createBigIntColumn({required String databaseId, required String tableId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +if (array != null) 'array': array, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnBigint.fromMap(res.data); + + } + + /// Update a bigint column. Changing the `default` value will not update + /// already existing rows. + /// + Future updateBigIntColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + + final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'min': min, +'max': max, +'default': xdefault, +'newKey': newKey, + + }; + + final Map apiHeaders = { + 'content-type': 'application/json', + + }; + + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + + return models.ColumnBigint.fromMap(res.data); + + } + + /// Create a boolean column. + /// + Future createBooleanColumn({required String databaseId, required String tableId, required String key, required bool xrequired, bool? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + + final Map apiParams = { + + 'key': key, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnBoolean.fromMap(res.data); - } + + } /// Update a boolean column. Changing the `default` value will not update /// already existing rows. - Future updateBooleanColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required bool? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future updateBooleanColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required bool? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnBoolean.fromMap(res.data); - } + + } /// Create a date time column according to the ISO 8601 standard. - Future createDatetimeColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createDatetimeColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnDatetime.fromMap(res.data); - } + + } /// Update a date time column. Changing the `default` value will not update /// already existing rows. - Future updateDatetimeColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future updateDatetimeColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnDatetime.fromMap(res.data); - } + + } /// Create an email column. - /// - Future createEmailColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/email' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createEmailColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEmail.fromMap(res.data); - } + + } /// Update an email column. Changing the `default` value will not update /// already existing rows. - /// - Future updateEmailColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateEmailColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEmail.fromMap(res.data); - } + + } /// Create an enumeration column. The `elements` param acts as a white-list of /// accepted values for this column. - Future createEnumColumn( - {required String databaseId, - required String tableId, - required String key, - required List elements, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/enum' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createEnumColumn({required String databaseId, required String tableId, required String key, required List elements, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'elements': elements, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'elements': elements, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEnum.fromMap(res.data); - } + + } /// Update an enum column. Changing the `default` value will not update already /// existing rows. - /// - Future updateEnumColumn( - {required String databaseId, - required String tableId, - required String key, - required List elements, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateEnumColumn({required String databaseId, required String tableId, required String key, required List elements, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'elements': elements, - 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'required': xrequired, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEnum.fromMap(res.data); - } + + } /// Create a float column. Optionally, minimum and maximum values can be /// provided. - /// - Future createFloatColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - double? min, - double? max, - double? xdefault, - bool? array}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/float' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createFloatColumn({required String databaseId, required String tableId, required String key, required bool xrequired, double? min, double? max, double? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnFloat.fromMap(res.data); - } + + } /// Update a float column. Changing the `default` value will not update already /// existing rows. - /// - Future updateFloatColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required double? xdefault, - double? min, - double? max, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateFloatColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required double? xdefault, double? min, double? max, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - 'newKey': newKey, +'min': min, +'max': max, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnFloat.fromMap(res.data); - } + + } /// Create an integer column. Optionally, minimum and maximum values can be /// provided. - /// - Future createIntegerColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - int? min, - int? max, - int? xdefault, - bool? array}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/integer' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createIntegerColumn({required String databaseId, required String tableId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'min': min, +'max': max, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnInteger.fromMap(res.data); - } + + } /// Update an integer column. Changing the `default` value will not update /// already existing rows. - /// - Future updateIntegerColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required int? xdefault, - int? min, - int? max, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateIntegerColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'min': min, - 'max': max, - 'default': xdefault, - 'newKey': newKey, +'min': min, +'max': max, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnInteger.fromMap(res.data); - } + + } /// Create IP address column. - /// - Future createIpColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createIpColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIp.fromMap(res.data); - } + + } /// Update an ip column. Changing the `default` value will not update already /// existing rows. - /// - Future updateIpColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateIpColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIp.fromMap(res.data); - } + + } /// Create a geometric line column. - Future createLineColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - List? xdefault}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/line' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createLineColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, +'required': xrequired, +'default': xdefault, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLine.fromMap(res.data); - } + + } /// Update a line column. Changing the `default` value will not update already /// existing rows. - Future updateLineColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - List? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future updateLineColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLine.fromMap(res.data); - } + + } /// Create a longtext column. - /// - Future createLongtextColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createLongtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLongtext.fromMap(res.data); - } + + } /// Update a longtext column. Changing the `default` value will not update /// already existing rows. - /// - Future updateLongtextColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateLongtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLongtext.fromMap(res.data); - } + + } /// Create a mediumtext column. - /// - Future createMediumtextColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createMediumtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnMediumtext.fromMap(res.data); - } + + } /// Update a mediumtext column. Changing the `default` value will not update /// already existing rows. - /// - Future updateMediumtextColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateMediumtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnMediumtext.fromMap(res.data); - } + + } /// Create a geometric point column. - Future createPointColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - List? xdefault}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/point' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createPointColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, +'required': xrequired, +'default': xdefault, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPoint.fromMap(res.data); - } + + } /// Update a point column. Changing the `default` value will not update already /// existing rows. - Future updatePointColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - List? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future updatePointColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPoint.fromMap(res.data); - } + + } /// Create a geometric polygon column. - Future createPolygonColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - List? xdefault}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createPolygonColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, +'required': xrequired, +'default': xdefault, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPolygon.fromMap(res.data); - } + + } /// Update a polygon column. Changing the `default` value will not update /// already existing rows. - Future updatePolygonColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - List? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future updatePolygonColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPolygon.fromMap(res.data); - } + + } /// Create relationship column. [Learn more about relationship /// columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - /// - Future createRelationshipColumn( - {required String databaseId, - required String tableId, - required String relatedTableId, - required enums.RelationshipType type, - bool? twoWay, - String? key, - String? twoWayKey, - enums.RelationMutate? onDelete}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createRelationshipColumn({required String databaseId, required String tableId, required String relatedTableId, required enums.RelationshipType type, bool? twoWay, String? key, String? twoWayKey, enums.RelationMutate? onDelete}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'relatedTableId': relatedTableId, - 'type': type.value, - if (twoWay != null) 'twoWay': twoWay, - 'key': key, - 'twoWayKey': twoWayKey, - if (onDelete != null) 'onDelete': onDelete.value, +'type': type.value, +if (twoWay != null) 'twoWay': twoWay, +'key': key, +'twoWayKey': twoWayKey, +if (onDelete != null) 'onDelete': onDelete.value, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnRelationship.fromMap(res.data); - } + + } /// Create a string column. - /// - @Deprecated( - 'This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead.') - Future createStringColumn( - {required String databaseId, - required String tableId, - required String key, - required int size, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/string' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + @Deprecated('This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead.') + Future createStringColumn({required String databaseId, required String tableId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'size': size, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnString.fromMap(res.data); - } + + } /// Update a string column. Changing the `default` value will not update /// already existing rows. - /// - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead.') - Future updateStringColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - int? size, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead.') + Future updateStringColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'size': size, - 'newKey': newKey, +'default': xdefault, +'size': size, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnString.fromMap(res.data); - } + + } /// Create a text column. - /// - Future createTextColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/text' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createTextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnText.fromMap(res.data); - } + + } /// Update a text column. Changing the `default` value will not update already /// existing rows. - /// - Future updateTextColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateTextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnText.fromMap(res.data); - } + + } /// Create a URL column. - /// - Future createUrlColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - String? xdefault, - bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createUrlColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnUrl.fromMap(res.data); - } + + } /// Update an url column. Changing the `default` value will not update already /// existing rows. - /// - Future updateUrlColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateUrlColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'newKey': newKey, +'default': xdefault, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnUrl.fromMap(res.data); - } + + } /// Create a varchar column. - /// - Future createVarcharColumn( - {required String databaseId, - required String tableId, - required String key, - required int size, - required bool xrequired, - String? xdefault, - bool? array, - bool? encrypt}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future createVarcharColumn({required String databaseId, required String tableId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'size': size, - 'required': xrequired, - 'default': xdefault, - if (array != null) 'array': array, - if (encrypt != null) 'encrypt': encrypt, +'size': size, +'required': xrequired, +'default': xdefault, +if (array != null) 'array': array, +if (encrypt != null) 'encrypt': encrypt, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnVarchar.fromMap(res.data); - } + + } /// Update a varchar column. Changing the `default` value will not update /// already existing rows. - /// - Future updateVarcharColumn( - {required String databaseId, - required String tableId, - required String key, - required bool xrequired, - required String? xdefault, - int? size, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateVarcharColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'required': xrequired, - 'default': xdefault, - 'size': size, - 'newKey': newKey, +'default': xdefault, +'size': size, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnVarchar.fromMap(res.data); - } + + } /// Get column by ID. - Future getColumn( - {required String databaseId, - required String tableId, - required String key}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future getColumn({required String databaseId, required String tableId, required String key}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError( - 'Unable to match response to any expected response model.'); + throw StateError('Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -1488,513 +1322,427 @@ class TablesDB extends Service { return models.ColumnString.fromMap(response); } - throw StateError( - 'Unable to match response to any expected response model.'); + throw StateError('Unable to match response to any expected response model.'); }(); - } + + } /// Deletes a column. - Future deleteColumn( - {required String databaseId, - required String tableId, - required String key}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future deleteColumn({required String databaseId, required String tableId, required String key}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Update relationship column. [Learn more about relationship /// columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - /// - Future updateRelationshipColumn( - {required String databaseId, - required String tableId, - required String key, - enums.RelationMutate? onDelete, - String? newKey}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + /// + Future updateRelationshipColumn({required String databaseId, required String tableId, required String key, enums.RelationMutate? onDelete, String? newKey}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); final Map apiParams = { + 'onDelete': onDelete?.value, - 'newKey': newKey, +'newKey': newKey, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnRelationship.fromMap(res.data); - } + + } /// List indexes on the table. - Future listIndexes( - {required String databaseId, - required String tableId, - List? queries, - bool? total}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future listIndexes({required String databaseId, required String tableId, List? queries, bool? total}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIndexList.fromMap(res.data); - } + + } /// Creates an index on the columns listed. Your index should include all the /// columns you will query in a single request. /// Type can be `key`, `fulltext`, or `unique`. - Future createIndex( - {required String databaseId, - required String tableId, - required String key, - required enums.TablesDBIndexType type, - required List columns, - List? orders, - List? lengths}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createIndex({required String databaseId, required String tableId, required String key, required enums.TablesDBIndexType type, required List columns, List? orders, List? lengths}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'key': key, - 'type': type.value, - 'columns': columns, - if (orders != null) 'orders': orders.map((e) => e.value).toList(), - if (lengths != null) 'lengths': lengths, +'type': type.value, +'columns': columns, +if (orders != null) 'orders': orders.map((e) => e.value).toList(), +if (lengths != null) 'lengths': lengths, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIndex.fromMap(res.data); - } + + } /// Get index by ID. - Future getIndex( - {required String databaseId, - required String tableId, - required String key}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future getIndex({required String databaseId, required String tableId, required String key}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIndex.fromMap(res.data); - } + + } /// Delete an index. - Future deleteIndex( - {required String databaseId, - required String tableId, - required String key}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{key}', key); + Future deleteIndex({required String databaseId, required String tableId, required String key}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Get a list of all the user's rows in a given table. You can use the query /// params to filter your results. - Future listRows( - {required String databaseId, - required String tableId, - List? queries, - String? transactionId, - bool? total, - int? ttl}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future listRows({required String databaseId, required String tableId, List? queries, String? transactionId, bool? total, int? ttl}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { if (queries != null) 'queries': queries, - if (transactionId != null) 'transactionId': transactionId, - if (total != null) 'total': total, - if (ttl != null) 'ttl': ttl, +if (transactionId != null) 'transactionId': transactionId, +if (total != null) 'total': total, +if (ttl != null) 'ttl': ttl, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - } + + } /// Create a new Row. Before using this route, you should create a new table /// resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future createRow( - {required String databaseId, - required String tableId, - required String rowId, - required Map data, - List? permissions, - String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rowId': rowId, - 'data': data, - 'permissions': permissions, - 'transactionId': transactionId, +'data': data, +'permissions': permissions, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } + + } /// Create new Rows. Before using this route, you should create a new table /// resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future createRows( - {required String databaseId, - required String tableId, - required List rows, - String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future createRows({required String databaseId, required String tableId, required List rows, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rows': rows, - 'transactionId': transactionId, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - } + + } /// Create or update Rows. Before using this route, you should create a new /// table resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - /// - Future upsertRows( - {required String databaseId, - required String tableId, - required List rows, - String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + /// + Future upsertRows({required String databaseId, required String tableId, required List rows, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + 'rows': rows, - 'transactionId': transactionId, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - } + + } /// Update all rows that match your queries, if no queries are submitted then /// all rows are updated. You can pass only specific fields to be updated. - Future updateRows( - {required String databaseId, - required String tableId, - Map? data, - List? queries, - String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future updateRows({required String databaseId, required String tableId, Map? data, List? queries, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + if (data != null) 'data': data, - if (queries != null) 'queries': queries, - 'transactionId': transactionId, +if (queries != null) 'queries': queries, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - } + + } /// Bulk delete rows using queries, if no queries are passed then all rows are /// deleted. - Future deleteRows( - {required String databaseId, - required String tableId, - List? queries, - String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId); + Future deleteRows({required String databaseId, required String tableId, List? queries, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); final Map apiParams = { + if (queries != null) 'queries': queries, - 'transactionId': transactionId, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - } + + } /// Get a row by its unique ID. This endpoint response returns a JSON object /// with the row data. - Future getRow( - {required String databaseId, - required String tableId, - required String rowId, - List? queries, - String? transactionId}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); + Future getRow({required String databaseId, required String tableId, required String rowId, List? queries, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { if (queries != null) 'queries': queries, - if (transactionId != null) 'transactionId': transactionId, +if (transactionId != null) 'transactionId': transactionId, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } + + } /// Create or update a Row. Before using this route, you should create a new /// table resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future upsertRow( - {required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - String? transactionId}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); + Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + if (data != null) 'data': data, - 'permissions': permissions, - 'transactionId': transactionId, +'permissions': permissions, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } + + } /// Update a row by its unique ID. Using the patch method you can pass only /// specific fields that will get updated. - Future updateRow( - {required String databaseId, - required String tableId, - required String rowId, - Map? data, - List? permissions, - String? transactionId}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); + Future updateRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + if (data != null) 'data': data, - 'permissions': permissions, - 'transactionId': transactionId, +'permissions': permissions, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } + + } /// Delete a row by its unique ID. - Future deleteRow( - {required String databaseId, - required String tableId, - required String rowId, - String? transactionId}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId); + Future deleteRow({required String databaseId, required String tableId, required String rowId, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); final Map apiParams = { + 'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Decrement a specific column of a row by a given value. - Future decrementRowColumn( - {required String databaseId, - required String tableId, - required String rowId, - required String column, - double? value, - double? min, - String? transactionId}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId) - .replaceAll('{column}', column); + Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId).replaceAll('{column}', column); final Map apiParams = { + if (value != null) 'value': value, - 'min': min, - 'transactionId': transactionId, +'min': min, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } + + } /// Increment a specific column of a row by a given value. - Future incrementRowColumn( - {required String databaseId, - required String tableId, - required String rowId, - required String column, - double? value, - double? max, - String? transactionId}) async { - final String apiPath = - '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' - .replaceAll('{databaseId}', databaseId) - .replaceAll('{tableId}', tableId) - .replaceAll('{rowId}', rowId) - .replaceAll('{column}', column); + Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max, String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId).replaceAll('{column}', column); final Map apiParams = { + if (value != null) 'value': value, - 'max': max, - 'transactionId': transactionId, +'max': max, +'transactionId': transactionId, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - } + + } } diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 32546bd3..11062a30 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,129 +1,142 @@ part of '../dart_appwrite.dart'; -/// The Teams service allows you to group users of your project and to enable -/// them to share read and write access to your project resources + /// The Teams service allows you to group users of your project and to enable + /// them to share read and write access to your project resources class Teams extends Service { - Teams(super.client); + Teams(super.client); /// Get a list of all the teams in which the current user is a member. You can /// use the parameters to filter your results. - Future list( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/teams'; + Future list({List? queries, String? search, bool? total}) async { + final String apiPath = '/teams'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TeamList.fromMap(res.data); - } + + } /// Create a new team. The user who creates the team will automatically be /// assigned as the owner of the team. Only the users with the owner role can /// invite new members, add new owners and delete or update the team. - Future create( - {required String teamId, - required String name, - List? roles}) async { - final String apiPath = '/teams'; + Future create({required String teamId, required String name, List? roles}) async { + final String apiPath = '/teams'; final Map apiParams = { + 'teamId': teamId, - 'name': name, - if (roles != null) 'roles': roles, +'name': name, +if (roles != null) 'roles': roles, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Team.fromMap(res.data); - } + + } /// Get a team by its ID. All team members have read access for this resource. - Future get({required String teamId}) async { - final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); + Future get({required String teamId}) async { + final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Team.fromMap(res.data); - } + + } /// Update the team's name by its unique ID. - Future updateName( - {required String teamId, required String name}) async { - final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); + Future updateName({required String teamId, required String name}) async { + final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); final Map apiParams = { + 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Team.fromMap(res.data); - } + + } /// Delete a team using its ID. Only team members with the owner role can /// delete the team. - Future delete({required String teamId}) async { - final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); + Future delete({required String teamId}) async { + final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Use this endpoint to list a team's members using the team's ID. All team /// members have read access to this endpoint. Hide sensitive attributes from /// the response by toggling membership privacy in the Console. - Future listMemberships( - {required String teamId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = - '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships({required String teamId, List? queries, String? search, bool? total}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MembershipList.fromMap(res.data); - } + + } /// Invite a new member to join your team. Provide an ID for existing users, or /// invite unregistered users using an email or phone number. If initiated from @@ -131,184 +144,182 @@ class Teams extends Service { /// team to the invited user, and an account will be created for them if one /// doesn't exist. If initiated from a Server SDK, the new member will be added /// automatically to the team. - /// + /// /// You only need to provide one of a user ID, email, or phone number. Appwrite /// will prioritize accepting the user ID > email > phone number if you provide /// more than one of these parameters. - /// + /// /// Use the `url` parameter to redirect the user from the invitation email to /// your app. After the user is redirected, use the [Update Team Membership /// Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) - /// endpoint to allow the user to accept the invitation to the team. - /// + /// endpoint to allow the user to accept the invitation to the team. + /// /// Please note that to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) /// Appwrite will accept the only redirect URLs under the domains you have /// added as a platform on the Appwrite Console. - /// - Future createMembership( - {required String teamId, - required List roles, - String? email, - String? userId, - String? phone, - String? url, - String? name}) async { - final String apiPath = - '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + /// + Future createMembership({required String teamId, required List roles, String? email, String? userId, String? phone, String? url, String? name}) async { + final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { + if (email != null) 'email': email, - if (userId != null) 'userId': userId, - if (phone != null) 'phone': phone, - 'roles': roles, - if (url != null) 'url': url, - if (name != null) 'name': name, +if (userId != null) 'userId': userId, +if (phone != null) 'phone': phone, +'roles': roles, +if (url != null) 'url': url, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - } + + } /// Get a team member by the membership unique id. All team members have read /// access for this resource. Hide sensitive attributes from the response by /// toggling membership privacy in the Console. - Future getMembership( - {required String teamId, required String membershipId}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}' - .replaceAll('{teamId}', teamId) - .replaceAll('{membershipId}', membershipId); + Future getMembership({required String teamId, required String membershipId}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - } + + } /// Modify the roles of a team member. Only team members with the owner role /// have access to this endpoint. Learn more about [roles and /// permissions](https://appwrite.io/docs/permissions). - /// - Future updateMembership( - {required String teamId, - required String membershipId, - required List roles}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}' - .replaceAll('{teamId}', teamId) - .replaceAll('{membershipId}', membershipId); + /// + Future updateMembership({required String teamId, required String membershipId, required List roles}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); final Map apiParams = { + 'roles': roles, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - } + + } /// This endpoint allows a user to leave a team or for a team owner to delete /// the membership of any other team member. You can also use this endpoint to /// delete a user membership even if it is not accepted. - Future deleteMembership( - {required String teamId, required String membershipId}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}' - .replaceAll('{teamId}', teamId) - .replaceAll('{membershipId}', membershipId); + Future deleteMembership({required String teamId, required String membershipId}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Use this endpoint to allow a user to accept an invitation to join a team /// after being redirected back to your app from the invitation email received /// by the user. - /// + /// /// If the request is successful, a session for the user is automatically /// created. - /// - Future updateMembershipStatus( - {required String teamId, - required String membershipId, - required String userId, - required String secret}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}/status' - .replaceAll('{teamId}', teamId) - .replaceAll('{membershipId}', membershipId); + /// + Future updateMembershipStatus({required String teamId, required String membershipId, required String userId, required String secret}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); final Map apiParams = { + 'userId': userId, - 'secret': secret, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - } + + } /// Get the team's shared preferences by its unique ID. If a preference doesn't /// need to be shared by all team members, prefer storing them in [user /// preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). - Future getPrefs({required String teamId}) async { - final String apiPath = - '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); + Future getPrefs({required String teamId}) async { + final String apiPath = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - } + + } /// Update the team's preferences by its unique ID. The object you pass is /// stored as is and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws an error if exceeded. - Future updatePrefs( - {required String teamId, required Map prefs}) async { - final String apiPath = - '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); + Future updatePrefs({required String teamId, required Map prefs}) async { + final String apiPath = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); final Map apiParams = { + 'prefs': prefs, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - } + + } } diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 50115e87..5bed5441 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,103 +1,110 @@ part of '../dart_appwrite.dart'; class Tokens extends Service { - Tokens(super.client); + Tokens(super.client); /// List all the tokens created for a specific file or bucket. You can use the /// query params to filter your results. - Future list( - {required String bucketId, - required String fileId, - List? queries, - bool? total}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future list({required String bucketId, required String fileId, List? queries, bool? total}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceTokenList.fromMap(res.data); - } + + } /// Create a new token. A token is linked to a file. Token can be passed as a /// request URL search parameter. - Future createFileToken( - {required String bucketId, - required String fileId, - String? expire}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' - .replaceAll('{bucketId}', bucketId) - .replaceAll('{fileId}', fileId); + Future createFileToken({required String bucketId, required String fileId, String? expire}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); final Map apiParams = { + 'expire': expire, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceToken.fromMap(res.data); - } + + } /// Get a token by its unique ID. - Future get({required String tokenId}) async { - final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); + Future get({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceToken.fromMap(res.data); - } + + } /// Update a token by its unique ID. Use this endpoint to update a token's /// expiry date. - Future update( - {required String tokenId, String? expire}) async { - final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); + Future update({required String tokenId, String? expire}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); final Map apiParams = { + 'expire': expire, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceToken.fromMap(res.data); - } + + } /// Delete a token by its unique ID. - Future delete({required String tokenId}) async { - final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } } diff --git a/lib/services/users.dart b/lib/services/users.dart index 6804e339..fc282b7c 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,320 +1,316 @@ part of '../dart_appwrite.dart'; -/// The Users service allows you to manage your project users. + /// The Users service allows you to manage your project users. class Users extends Service { - Users(super.client); + Users(super.client); /// Get a list of all the project's users. You can use the query params to /// filter your results. - Future list( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/users'; + Future list({List? queries, String? search, bool? total}) async { + final String apiPath = '/users'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.UserList.fromMap(res.data); - } + + } /// Create a new user. - Future create( - {required String userId, - String? email, - String? phone, - String? password, - String? name}) async { - final String apiPath = '/users'; + Future create({required String userId, String? email, String? phone, String? password, String? name}) async { + final String apiPath = '/users'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'phone': phone, - if (password != null) 'password': password, - if (name != null) 'name': name, +'email': email, +'phone': phone, +if (password != null) 'password': password, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Create a new user. Password provided must be hashed with the /// [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createArgon2User( - {required String userId, - required String email, - required String password, - String? name}) async { - final String apiPath = '/users/argon2'; + Future createArgon2User({required String userId, required String email, required String password, String? name}) async { + final String apiPath = '/users/argon2'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - if (name != null) 'name': name, +'email': email, +'password': password, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Create a new user. Password provided must be hashed with the /// [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createBcryptUser( - {required String userId, - required String email, - required String password, - String? name}) async { - final String apiPath = '/users/bcrypt'; + Future createBcryptUser({required String userId, required String email, required String password, String? name}) async { + final String apiPath = '/users/bcrypt'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - if (name != null) 'name': name, +'email': email, +'password': password, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Get identities for all users. - Future listIdentities( - {List? queries, String? search, bool? total}) async { - final String apiPath = '/users/identities'; + Future listIdentities({List? queries, String? search, bool? total}) async { + final String apiPath = '/users/identities'; final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.IdentityList.fromMap(res.data); - } + + } /// Delete an identity by its unique ID. - Future deleteIdentity({required String identityId}) async { - final String apiPath = - '/users/identities/{identityId}'.replaceAll('{identityId}', identityId); + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/users/identities/{identityId}'.replaceAll('{identityId}', identityId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Create a new user. Password provided must be hashed with the /// [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createMD5User( - {required String userId, - required String email, - required String password, - String? name}) async { - final String apiPath = '/users/md5'; + Future createMD5User({required String userId, required String email, required String password, String? name}) async { + final String apiPath = '/users/md5'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - if (name != null) 'name': name, +'email': email, +'password': password, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Create a new user. Password provided must be hashed with the /// [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createPHPassUser( - {required String userId, - required String email, - required String password, - String? name}) async { - final String apiPath = '/users/phpass'; + Future createPHPassUser({required String userId, required String email, required String password, String? name}) async { + final String apiPath = '/users/phpass'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - if (name != null) 'name': name, +'email': email, +'password': password, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Create a new user. Password provided must be hashed with the /// [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createScryptUser( - {required String userId, - required String email, - required String password, - required String passwordSalt, - required int passwordCpu, - required int passwordMemory, - required int passwordParallel, - required int passwordLength, - String? name}) async { - final String apiPath = '/users/scrypt'; + Future createScryptUser({required String userId, required String email, required String password, required String passwordSalt, required int passwordCpu, required int passwordMemory, required int passwordParallel, required int passwordLength, String? name}) async { + final String apiPath = '/users/scrypt'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - 'passwordSalt': passwordSalt, - 'passwordCpu': passwordCpu, - 'passwordMemory': passwordMemory, - 'passwordParallel': passwordParallel, - 'passwordLength': passwordLength, - if (name != null) 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordCpu': passwordCpu, +'passwordMemory': passwordMemory, +'passwordParallel': passwordParallel, +'passwordLength': passwordLength, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Create a new user. Password provided must be hashed with the [Scrypt /// Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) /// algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createScryptModifiedUser( - {required String userId, - required String email, - required String password, - required String passwordSalt, - required String passwordSaltSeparator, - required String passwordSignerKey, - String? name}) async { - final String apiPath = '/users/scrypt-modified'; + Future createScryptModifiedUser({required String userId, required String email, required String password, required String passwordSalt, required String passwordSaltSeparator, required String passwordSignerKey, String? name}) async { + final String apiPath = '/users/scrypt-modified'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - 'passwordSalt': passwordSalt, - 'passwordSaltSeparator': passwordSaltSeparator, - 'passwordSignerKey': passwordSignerKey, - if (name != null) 'name': name, +'email': email, +'password': password, +'passwordSalt': passwordSalt, +'passwordSaltSeparator': passwordSaltSeparator, +'passwordSignerKey': passwordSignerKey, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Create a new user. Password provided must be hashed with the /// [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use /// the [POST /users](https://appwrite.io/docs/server/users#usersCreate) /// endpoint to create users with a plain text password. - Future createSHAUser( - {required String userId, - required String email, - required String password, - enums.PasswordHash? passwordVersion, - String? name}) async { - final String apiPath = '/users/sha'; + Future createSHAUser({required String userId, required String email, required String password, enums.PasswordHash? passwordVersion, String? name}) async { + final String apiPath = '/users/sha'; final Map apiParams = { + 'userId': userId, - 'email': email, - 'password': password, - if (passwordVersion != null) 'passwordVersion': passwordVersion.value, - if (name != null) 'name': name, +'email': email, +'password': password, +if (passwordVersion != null) 'passwordVersion': passwordVersion.value, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Get a user by its unique ID. - Future get({required String userId}) async { - final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); + Future get({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Delete a user by its unique ID, thereby releasing it's ID. Since ID is /// released and can be reused, all user-related resources like documents or @@ -322,763 +318,812 @@ class Users extends Service { /// ID reserved, use the /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) /// endpoint instead. - Future delete({required String userId}) async { - final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Update the user email by its unique ID. - Future updateEmail( - {required String userId, required String email}) async { - final String apiPath = - '/users/{userId}/email'.replaceAll('{userId}', userId); + Future updateEmail({required String userId, required String email}) async { + final String apiPath = '/users/{userId}/email'.replaceAll('{userId}', userId); final Map apiParams = { + 'email': email, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Enable or disable whether a user can impersonate other users. When /// impersonation headers are used, the request runs as the target user for API /// behavior, while internal audit logs still attribute the action to the /// original impersonator and store the impersonated target details only in /// internal audit payload data. - /// - Future updateImpersonator( - {required String userId, required bool impersonator}) async { - final String apiPath = - '/users/{userId}/impersonator'.replaceAll('{userId}', userId); + /// + Future updateImpersonator({required String userId, required bool impersonator}) async { + final String apiPath = '/users/{userId}/impersonator'.replaceAll('{userId}', userId); final Map apiParams = { + 'impersonator': impersonator, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Use this endpoint to create a JSON Web Token for user by its unique ID. You /// can use the resulting JWT to authenticate on behalf of the user. The JWT /// secret will become invalid if the session it uses gets deleted. - Future createJWT( - {required String userId, String? sessionId, int? duration}) async { - final String apiPath = - '/users/{userId}/jwts'.replaceAll('{userId}', userId); + Future createJWT({required String userId, String? sessionId, int? duration}) async { + final String apiPath = '/users/{userId}/jwts'.replaceAll('{userId}', userId); final Map apiParams = { + if (sessionId != null) 'sessionId': sessionId, - if (duration != null) 'duration': duration, +if (duration != null) 'duration': duration, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Jwt.fromMap(res.data); - } - /// Update the user labels by its unique ID. - /// + } + + /// Update the user labels by its unique ID. + /// /// Labels can be used to grant access to resources. While teams are a way for /// user's to share access to a resource, labels can be defined by the /// developer to grant access without an invitation. See the [Permissions /// docs](https://appwrite.io/docs/permissions) for more info. - Future updateLabels( - {required String userId, required List labels}) async { - final String apiPath = - '/users/{userId}/labels'.replaceAll('{userId}', userId); + Future updateLabels({required String userId, required List labels}) async { + final String apiPath = '/users/{userId}/labels'.replaceAll('{userId}', userId); final Map apiParams = { + 'labels': labels, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Get the user activity logs list by its unique ID. - Future listLogs( - {required String userId, List? queries, bool? total}) async { - final String apiPath = - '/users/{userId}/logs'.replaceAll('{userId}', userId); + Future listLogs({required String userId, List? queries, bool? total}) async { + final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - } + + } /// Get the user membership list by its unique ID. - Future listMemberships( - {required String userId, - List? queries, - String? search, - bool? total}) async { - final String apiPath = - '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships({required String userId, List? queries, String? search, bool? total}) async { + final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { if (queries != null) 'queries': queries, - if (search != null) 'search': search, - if (total != null) 'total': total, +if (search != null) 'search': search, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MembershipList.fromMap(res.data); - } + + } /// Enable or disable MFA on a user account. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.') - Future updateMfa( - {required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.') + Future updateMfa({required String userId, required bool mfa}) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); final Map apiParams = { + 'mfa': mfa, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Enable or disable MFA on a user account. - Future updateMFA( - {required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); + Future updateMFA({required String userId, required bool mfa}) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); final Map apiParams = { + 'mfa': mfa, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Delete an authenticator app. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.') - Future deleteMfaAuthenticator( - {required String userId, required enums.AuthenticatorType type}) async { - final String apiPath = '/users/{userId}/mfa/authenticators/{type}' - .replaceAll('{userId}', userId) - .replaceAll('{type}', type.value); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.') + Future deleteMfaAuthenticator({required String userId, required enums.AuthenticatorType type}) async { + final String apiPath = '/users/{userId}/mfa/authenticators/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Delete an authenticator app. - Future deleteMFAAuthenticator( - {required String userId, required enums.AuthenticatorType type}) async { - final String apiPath = '/users/{userId}/mfa/authenticators/{type}' - .replaceAll('{userId}', userId) - .replaceAll('{type}', type.value); + Future deleteMFAAuthenticator({required String userId, required enums.AuthenticatorType type}) async { + final String apiPath = '/users/{userId}/mfa/authenticators/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// List the factors available on the account to be used as a MFA challange. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead.') - Future listMfaFactors({required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead.') + Future listMfaFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - } + + } /// List the factors available on the account to be used as a MFA challange. - Future listMFAFactors({required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + Future listMFAFactors({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - } + + } /// Get recovery codes that can be used as backup for MFA flow by User ID. /// Before getting codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes( - {required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead.') + Future getMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Get recovery codes that can be used as backup for MFA flow by User ID. /// Before getting codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - Future getMFARecoveryCodes( - {required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + Future getMFARecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Regenerate recovery codes that can be used as backup for MFA flow by User /// ID. Before regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes( - {required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Regenerate recovery codes that can be used as backup for MFA flow by User /// ID. Before regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - Future updateMFARecoveryCodes( - {required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + Future updateMFARecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Generate recovery codes used as backup for MFA flow for User ID. Recovery /// codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method by client SDK. - @Deprecated( - 'This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes( - {required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead.') + Future createMfaRecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Generate recovery codes used as backup for MFA flow for User ID. Recovery /// codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method by client SDK. - Future createMFARecoveryCodes( - {required String userId}) async { - final String apiPath = - '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + Future createMFARecoveryCodes({required String userId}) async { + final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - } + + } /// Update the user name by its unique ID. - Future updateName( - {required String userId, required String name}) async { - final String apiPath = - '/users/{userId}/name'.replaceAll('{userId}', userId); + Future updateName({required String userId, required String name}) async { + final String apiPath = '/users/{userId}/name'.replaceAll('{userId}', userId); final Map apiParams = { + 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Update the user password by its unique ID. - Future updatePassword( - {required String userId, required String password}) async { - final String apiPath = - '/users/{userId}/password'.replaceAll('{userId}', userId); + Future updatePassword({required String userId, required String password}) async { + final String apiPath = '/users/{userId}/password'.replaceAll('{userId}', userId); final Map apiParams = { + 'password': password, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Update the user phone by its unique ID. - Future updatePhone( - {required String userId, required String number}) async { - final String apiPath = - '/users/{userId}/phone'.replaceAll('{userId}', userId); + Future updatePhone({required String userId, required String number}) async { + final String apiPath = '/users/{userId}/phone'.replaceAll('{userId}', userId); final Map apiParams = { + 'number': number, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Get the user preferences by its unique ID. - Future getPrefs({required String userId}) async { - final String apiPath = - '/users/{userId}/prefs'.replaceAll('{userId}', userId); + Future getPrefs({required String userId}) async { + final String apiPath = '/users/{userId}/prefs'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - } + + } /// Update the user preferences by its unique ID. The object you pass is stored /// as is, and replaces any previous value. The maximum allowed prefs size is /// 64kB and throws error if exceeded. - Future updatePrefs( - {required String userId, required Map prefs}) async { - final String apiPath = - '/users/{userId}/prefs'.replaceAll('{userId}', userId); + Future updatePrefs({required String userId, required Map prefs}) async { + final String apiPath = '/users/{userId}/prefs'.replaceAll('{userId}', userId); final Map apiParams = { + 'prefs': prefs, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - } + + } /// Get the user sessions list by its unique ID. - Future listSessions( - {required String userId, bool? total}) async { - final String apiPath = - '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions({required String userId, bool? total}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); final Map apiParams = { if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.SessionList.fromMap(res.data); - } + + } /// Creates a session for a user. Returns an immediately usable session object. - /// + /// /// If you want to generate a token for a custom authentication flow, use the /// [POST /// /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) /// endpoint. - Future createSession({required String userId}) async { - final String apiPath = - '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future createSession({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - } + + } /// Delete all user's sessions by using the user's unique ID. - Future deleteSessions({required String userId}) async { - final String apiPath = - '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future deleteSessions({required String userId}) async { + final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Delete a user sessions by its unique ID. - Future deleteSession( - {required String userId, required String sessionId}) async { - final String apiPath = '/users/{userId}/sessions/{sessionId}' - .replaceAll('{userId}', userId) - .replaceAll('{sessionId}', sessionId); + Future deleteSession({required String userId, required String sessionId}) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}'.replaceAll('{userId}', userId).replaceAll('{sessionId}', sessionId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Update the user status by its unique ID. Use this endpoint as an /// alternative to deleting a user if you want to keep user's ID reserved. - Future updateStatus( - {required String userId, required bool status}) async { - final String apiPath = - '/users/{userId}/status'.replaceAll('{userId}', userId); + Future updateStatus({required String userId, required bool status}) async { + final String apiPath = '/users/{userId}/status'.replaceAll('{userId}', userId); final Map apiParams = { + 'status': status, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// List the messaging targets that are associated with a user. - Future listTargets( - {required String userId, List? queries, bool? total}) async { - final String apiPath = - '/users/{userId}/targets'.replaceAll('{userId}', userId); + Future listTargets({required String userId, List? queries, bool? total}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.TargetList.fromMap(res.data); - } + + } /// Create a messaging target. - Future createTarget( - {required String userId, - required String targetId, - required enums.MessagingProviderType providerType, - required String identifier, - String? providerId, - String? name}) async { - final String apiPath = - '/users/{userId}/targets'.replaceAll('{userId}', userId); + Future createTarget({required String userId, required String targetId, required enums.MessagingProviderType providerType, required String identifier, String? providerId, String? name}) async { + final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); final Map apiParams = { + 'targetId': targetId, - 'providerType': providerType.value, - 'identifier': identifier, - if (providerId != null) 'providerId': providerId, - if (name != null) 'name': name, +'providerType': providerType.value, +'identifier': identifier, +if (providerId != null) 'providerId': providerId, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Target.fromMap(res.data); - } + + } /// Get a user's push notification target by ID. - Future getTarget( - {required String userId, required String targetId}) async { - final String apiPath = '/users/{userId}/targets/{targetId}' - .replaceAll('{userId}', userId) - .replaceAll('{targetId}', targetId); + Future getTarget({required String userId, required String targetId}) async { + final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Target.fromMap(res.data); - } + + } /// Update a messaging target. - Future updateTarget( - {required String userId, - required String targetId, - String? identifier, - String? providerId, - String? name}) async { - final String apiPath = '/users/{userId}/targets/{targetId}' - .replaceAll('{userId}', userId) - .replaceAll('{targetId}', targetId); + Future updateTarget({required String userId, required String targetId, String? identifier, String? providerId, String? name}) async { + final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); final Map apiParams = { + if (identifier != null) 'identifier': identifier, - if (providerId != null) 'providerId': providerId, - if (name != null) 'name': name, +if (providerId != null) 'providerId': providerId, +if (name != null) 'name': name, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Target.fromMap(res.data); - } + + } /// Delete a messaging target. - Future deleteTarget( - {required String userId, required String targetId}) async { - final String apiPath = '/users/{userId}/targets/{targetId}' - .replaceAll('{userId}', userId) - .replaceAll('{targetId}', targetId); + Future deleteTarget({required String userId, required String targetId}) async { + final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Returns a token with a secret key for creating a session. Use the user ID /// and secret and submit a request to the [PUT /// /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. - /// - Future createToken( - {required String userId, int? length, int? expire}) async { - final String apiPath = - '/users/{userId}/tokens'.replaceAll('{userId}', userId); + /// + Future createToken({required String userId, int? length, int? expire}) async { + final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); final Map apiParams = { + if (length != null) 'length': length, - if (expire != null) 'expire': expire, +if (expire != null) 'expire': expire, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - } + + } /// Update the user email verification status by its unique ID. - Future updateEmailVerification( - {required String userId, required bool emailVerification}) async { - final String apiPath = - '/users/{userId}/verification'.replaceAll('{userId}', userId); + Future updateEmailVerification({required String userId, required bool emailVerification}) async { + final String apiPath = '/users/{userId}/verification'.replaceAll('{userId}', userId); final Map apiParams = { + 'emailVerification': emailVerification, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } /// Update the user phone verification status by its unique ID. - Future updatePhoneVerification( - {required String userId, required bool phoneVerification}) async { - final String apiPath = - '/users/{userId}/verification/phone'.replaceAll('{userId}', userId); + Future updatePhoneVerification({required String userId, required bool phoneVerification}) async { + final String apiPath = '/users/{userId}/verification/phone'.replaceAll('{userId}', userId); final Map apiParams = { + 'phoneVerification': phoneVerification, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - } + + } } diff --git a/lib/services/webhooks.dart b/lib/services/webhooks.dart index ae5dd16f..3fd35e32 100644 --- a/lib/services/webhooks.dart +++ b/lib/services/webhooks.dart @@ -1,149 +1,149 @@ part of '../dart_appwrite.dart'; class Webhooks extends Service { - Webhooks(super.client); + Webhooks(super.client); /// Get a list of all webhooks belonging to the project. You can use the query /// params to filter your results. - Future list({List? queries, bool? total}) async { - final String apiPath = '/webhooks'; + Future list({List? queries, bool? total}) async { + final String apiPath = '/webhooks'; final Map apiParams = { if (queries != null) 'queries': queries, - if (total != null) 'total': total, +if (total != null) 'total': total, + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.WebhookList.fromMap(res.data); - } + + } /// Create a new webhook. Use this endpoint to configure a URL that will /// receive events from Appwrite when specific events occur. - Future create( - {required String webhookId, - required String url, - required String name, - required List events, - bool? enabled, - bool? tls, - String? authUsername, - String? authPassword, - String? secret}) async { - final String apiPath = '/webhooks'; + Future create({required String webhookId, required String url, required String name, required List events, bool? enabled, bool? tls, String? authUsername, String? authPassword, String? secret}) async { + final String apiPath = '/webhooks'; final Map apiParams = { + 'webhookId': webhookId, - 'url': url, - 'name': name, - 'events': events, - if (enabled != null) 'enabled': enabled, - if (tls != null) 'tls': tls, - if (authUsername != null) 'authUsername': authUsername, - if (authPassword != null) 'authPassword': authPassword, - 'secret': secret, +'url': url, +'name': name, +'events': events, +if (enabled != null) 'enabled': enabled, +if (tls != null) 'tls': tls, +if (authUsername != null) 'authUsername': authUsername, +if (authPassword != null) 'authPassword': authPassword, +'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.post, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - } + + } /// Get a webhook by its unique ID. This endpoint returns details about a - /// specific webhook configured for a project. - Future get({required String webhookId}) async { - final String apiPath = - '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); + /// specific webhook configured for a project. + Future get({required String webhookId}) async { + final String apiPath = '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); - final Map apiParams = {}; + final Map apiParams = { + + + }; - final Map apiHeaders = {}; + final Map apiHeaders = { + + }; - final res = await client.call(HttpMethod.get, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - } + + } /// Update a webhook by its unique ID. Use this endpoint to update the URL, /// events, or status of an existing webhook. - Future update( - {required String webhookId, - required String name, - required String url, - required List events, - bool? enabled, - bool? tls, - String? authUsername, - String? authPassword}) async { - final String apiPath = - '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); + Future update({required String webhookId, required String name, required String url, required List events, bool? enabled, bool? tls, String? authUsername, String? authPassword}) async { + final String apiPath = '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); final Map apiParams = { + 'name': name, - 'url': url, - 'events': events, - if (enabled != null) 'enabled': enabled, - if (tls != null) 'tls': tls, - if (authUsername != null) 'authUsername': authUsername, - if (authPassword != null) 'authPassword': authPassword, +'url': url, +'events': events, +if (enabled != null) 'enabled': enabled, +if (tls != null) 'tls': tls, +if (authUsername != null) 'authUsername': authUsername, +if (authPassword != null) 'authPassword': authPassword, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.put, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - } + + } /// Delete a webhook by its unique ID. Once deleted, the webhook will no longer - /// receive project events. - Future delete({required String webhookId}) async { - final String apiPath = - '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); + /// receive project events. + Future delete({required String webhookId}) async { + final String apiPath = '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); - final Map apiParams = {}; + final Map apiParams = { + + + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.delete, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - } + + } /// Update the webhook signing key. This endpoint can be used to regenerate the /// signing key used to sign and validate payload deliveries for a specific /// webhook. - Future updateSecret( - {required String webhookId, String? secret}) async { - final String apiPath = - '/webhooks/{webhookId}/secret'.replaceAll('{webhookId}', webhookId); + Future updateSecret({required String webhookId, String? secret}) async { + final String apiPath = '/webhooks/{webhookId}/secret'.replaceAll('{webhookId}', webhookId); final Map apiParams = { + 'secret': secret, + }; final Map apiHeaders = { 'content-type': 'application/json', + }; - final res = await client.call(HttpMethod.patch, - path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - } + + } } diff --git a/lib/src/client.dart b/lib/src/client.dart index 98cffb92..e0e1207c 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -21,14 +21,13 @@ abstract class Client { factory Client({ String endPoint = 'https://cloud.appwrite.io/v1', bool selfSigned = false, - }) => - createClient(endPoint: endPoint, selfSigned: selfSigned); + }) => createClient(endPoint: endPoint, selfSigned: selfSigned); /// Handle OAuth2 session creation. Future webAuth(Uri url); /// Set self signed to [status]. - /// + /// /// If self signed is true, [Client] will ignore invalid certificates. /// This is helpful in environments where your Appwrite /// instance does not have a valid SSL certificate. @@ -65,6 +64,16 @@ abstract class Client { /// The user agent string of the client that made the request Client setForwardedUserAgent(String value); + /// Set DevKey + /// + /// Your secret dev API key + Client setDevKey(String value); + + /// Set Cookie + /// + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + Client setCookie(String value); + /// Set ImpersonateUserId /// /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @@ -100,8 +109,7 @@ abstract class Client { }); /// Send the API request. - Future call( - HttpMethod method, { + Future call(HttpMethod method, { String path = '', Map headers = const {}, Map params = const {}, diff --git a/lib/src/client_base.dart b/lib/src/client_base.dart index 772f1e40..488ee0ce 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,37 +2,36 @@ import 'response.dart'; import 'client.dart'; import 'enums.dart'; -abstract class ClientBase implements Client { +abstract class ClientBase implements Client { /// Your project ID @override ClientBase setProject(value); - /// Your secret API key @override ClientBase setKey(value); - /// Your secret JSON Web Token @override ClientBase setJWT(value); @override ClientBase setLocale(value); - /// The user session to authenticate with @override ClientBase setSession(value); - /// The user agent string of the client that made the request @override ClientBase setForwardedUserAgent(value); - + /// Your secret dev API key + @override + ClientBase setDevKey(value); + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientBase setCookie(value); /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserId(value); - /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserEmail(value); - /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserPhone(value); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index d1a34e1c..95c71402 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -16,7 +16,7 @@ ClientBase createClient({ ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int chunkSize = 5 * 1024 * 1024; + static const int chunkSize = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -33,8 +33,8 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '23.0.0', - 'X-Appwrite-Response-Format': '1.9.1', + 'x-sdk-version': '23.1.0', + 'X-Appwrite-Response-Format' : '1.9.4', }; config = {}; @@ -46,76 +46,82 @@ class ClientBrowser extends ClientBase with ClientMixin { @override String get endPoint => _endPoint; - /// Your project ID - @override - ClientBrowser setProject(value) { - config['project'] = value; - addHeader('X-Appwrite-Project', value); - return this; - } - - /// Your secret API key - @override - ClientBrowser setKey(value) { - config['key'] = value; - addHeader('X-Appwrite-Key', value); - return this; - } - - /// Your secret JSON Web Token - @override - ClientBrowser setJWT(value) { - config['jWT'] = value; - addHeader('X-Appwrite-JWT', value); - return this; - } - - @override - ClientBrowser setLocale(value) { - config['locale'] = value; - addHeader('X-Appwrite-Locale', value); - return this; - } - - /// The user session to authenticate with - @override - ClientBrowser setSession(value) { - config['session'] = value; - addHeader('X-Appwrite-Session', value); - return this; - } - - /// The user agent string of the client that made the request - @override - ClientBrowser setForwardedUserAgent(value) { - config['forwardedUserAgent'] = value; - addHeader('X-Forwarded-User-Agent', value); - return this; - } - - /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientBrowser setImpersonateUserId(value) { - config['impersonateUserId'] = value; - addHeader('X-Appwrite-Impersonate-User-Id', value); - return this; - } - - /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientBrowser setImpersonateUserEmail(value) { - config['impersonateUserEmail'] = value; - addHeader('X-Appwrite-Impersonate-User-Email', value); - return this; - } - - /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientBrowser setImpersonateUserPhone(value) { - config['impersonateUserPhone'] = value; - addHeader('X-Appwrite-Impersonate-User-Phone', value); - return this; - } + /// Your project ID + @override + ClientBrowser setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + /// Your secret API key + @override + ClientBrowser setKey(value) { + config['key'] = value; + addHeader('X-Appwrite-Key', value); + return this; + } + /// Your secret JSON Web Token + @override + ClientBrowser setJWT(value) { + config['jWT'] = value; + addHeader('X-Appwrite-JWT', value); + return this; + } + @override + ClientBrowser setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + /// The user session to authenticate with + @override + ClientBrowser setSession(value) { + config['session'] = value; + addHeader('X-Appwrite-Session', value); + return this; + } + /// The user agent string of the client that made the request + @override + ClientBrowser setForwardedUserAgent(value) { + config['forwardedUserAgent'] = value; + addHeader('X-Forwarded-User-Agent', value); + return this; + } + /// Your secret dev API key + @override + ClientBrowser setDevKey(value) { + config['devKey'] = value; + addHeader('X-Appwrite-Dev-Key', value); + return this; + } + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientBrowser setCookie(value) { + config['cookie'] = value; + addHeader('Cookie', value); + return this; + } + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientBrowser setImpersonateUserId(value) { + config['impersonateUserId'] = value; + addHeader('X-Appwrite-Impersonate-User-Id', value); + return this; + } + /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientBrowser setImpersonateUserEmail(value) { + config['impersonateUserEmail'] = value; + addHeader('X-Appwrite-Impersonate-User-Email', value); + return this; + } + /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientBrowser setImpersonateUserPhone(value) { + config['impersonateUserPhone'] = value; + addHeader('X-Appwrite-Impersonate-User-Phone', value); + return this; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -169,8 +175,7 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= chunkSize) { - params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, - filename: file.filename); + params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, filename: file.filename); return call( HttpMethod.post, path: path, @@ -197,8 +202,8 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + chunkSize, size); chunk = file.bytes!.getRange(offset, end).toList(); - params[paramName] = http.MultipartFile.fromBytes(paramName, chunk, - filename: file.filename); + params[paramName] = + http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); headers['content-range'] = 'bytes $offset-${min((offset + chunkSize - 1), size - 1)}/$size'; res = await call(HttpMethod.post, diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 4f23d9c2..35cc40d4 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -20,7 +20,7 @@ ClientBase createClient({ ); class ClientIO extends ClientBase with ClientMixin { - static const int chunkSize = 5 * 1024 * 1024; + static const int chunkSize = 5*1024*1024; String _endPoint; Map? _headers; @override @@ -42,10 +42,9 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Dart', 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', - 'x-sdk-version': '23.0.0', - 'user-agent': - 'AppwriteDartSDK/23.0.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format': '1.9.1', + 'x-sdk-version': '23.1.0', + 'user-agent' : 'AppwriteDartSDK/23.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format' : '1.9.4', }; config = {}; @@ -57,76 +56,82 @@ class ClientIO extends ClientBase with ClientMixin { @override String get endPoint => _endPoint; - /// Your project ID - @override - ClientIO setProject(value) { - config['project'] = value; - addHeader('X-Appwrite-Project', value); - return this; - } - - /// Your secret API key - @override - ClientIO setKey(value) { - config['key'] = value; - addHeader('X-Appwrite-Key', value); - return this; - } - - /// Your secret JSON Web Token - @override - ClientIO setJWT(value) { - config['jWT'] = value; - addHeader('X-Appwrite-JWT', value); - return this; - } - - @override - ClientIO setLocale(value) { - config['locale'] = value; - addHeader('X-Appwrite-Locale', value); - return this; - } - - /// The user session to authenticate with - @override - ClientIO setSession(value) { - config['session'] = value; - addHeader('X-Appwrite-Session', value); - return this; - } - - /// The user agent string of the client that made the request - @override - ClientIO setForwardedUserAgent(value) { - config['forwardedUserAgent'] = value; - addHeader('X-Forwarded-User-Agent', value); - return this; - } - - /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientIO setImpersonateUserId(value) { - config['impersonateUserId'] = value; - addHeader('X-Appwrite-Impersonate-User-Id', value); - return this; - } - - /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientIO setImpersonateUserEmail(value) { - config['impersonateUserEmail'] = value; - addHeader('X-Appwrite-Impersonate-User-Email', value); - return this; - } - - /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientIO setImpersonateUserPhone(value) { - config['impersonateUserPhone'] = value; - addHeader('X-Appwrite-Impersonate-User-Phone', value); - return this; - } + /// Your project ID + @override + ClientIO setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + /// Your secret API key + @override + ClientIO setKey(value) { + config['key'] = value; + addHeader('X-Appwrite-Key', value); + return this; + } + /// Your secret JSON Web Token + @override + ClientIO setJWT(value) { + config['jWT'] = value; + addHeader('X-Appwrite-JWT', value); + return this; + } + @override + ClientIO setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + /// The user session to authenticate with + @override + ClientIO setSession(value) { + config['session'] = value; + addHeader('X-Appwrite-Session', value); + return this; + } + /// The user agent string of the client that made the request + @override + ClientIO setForwardedUserAgent(value) { + config['forwardedUserAgent'] = value; + addHeader('X-Forwarded-User-Agent', value); + return this; + } + /// Your secret dev API key + @override + ClientIO setDevKey(value) { + config['devKey'] = value; + addHeader('X-Appwrite-Dev-Key', value); + return this; + } + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientIO setCookie(value) { + config['cookie'] = value; + addHeader('Cookie', value); + return this; + } + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientIO setImpersonateUserId(value) { + config['impersonateUserId'] = value; + addHeader('X-Appwrite-Impersonate-User-Id', value); + return this; + } + /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientIO setImpersonateUserEmail(value) { + config['impersonateUserEmail'] = value; + addHeader('X-Appwrite-Impersonate-User-Email', value); + return this; + } + /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientIO setImpersonateUserPhone(value) { + config['impersonateUserPhone'] = value; + addHeader('X-Appwrite-Impersonate-User-Phone', value); + return this; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -229,8 +234,8 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(chunkSize); } - params[paramName] = http.MultipartFile.fromBytes(paramName, chunk, - filename: file.filename); + params[paramName] = + http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); headers['content-range'] = 'bytes $offset-${min((offset + chunkSize - 1), size - 1)}/$size'; res = await call(HttpMethod.post, diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index dbb8106c..da94c3cb 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -12,6 +12,7 @@ mixin ClientMixin { required Map headers, required Map params, }) { + http.BaseRequest request = http.Request(method.name(), uri); if (headers['content-type'] == 'multipart/form-data') { request = http.MultipartRequest(method.name(), uri); @@ -73,8 +74,7 @@ mixin ClientMixin { headers['User-Agent'] = Uri.encodeFull(headers['User-Agent']!); } if (headers['X-Forwarded-User-Agent'] != null) { - headers['X-Forwarded-User-Agent'] = - Uri.encodeFull(headers['X-Forwarded-User-Agent']!); + headers['X-Forwarded-User-Agent'] = Uri.encodeFull(headers['X-Forwarded-User-Agent']!); } request.headers.addAll(headers); @@ -121,23 +121,18 @@ mixin ClientMixin { return Response(data: data); } - Future toResponse( - http.StreamedResponse streamedResponse) async { - if (streamedResponse.statusCode == 204) { - return http.Response( - '', - streamedResponse.statusCode, - headers: streamedResponse.headers.map((k, v) => - k.toLowerCase() == 'content-type' - ? MapEntry(k, 'text/plain') - : MapEntry(k, v)), - request: streamedResponse.request, - isRedirect: streamedResponse.isRedirect, - persistentConnection: streamedResponse.persistentConnection, - reasonPhrase: streamedResponse.reasonPhrase, - ); - } else { - return await http.Response.fromStream(streamedResponse); - } + Future toResponse(http.StreamedResponse streamedResponse) async { + if(streamedResponse.statusCode == 204) { + return http.Response('', + streamedResponse.statusCode, + headers: streamedResponse.headers.map((k,v) => k.toLowerCase()=='content-type' ? MapEntry(k, 'text/plain') : MapEntry(k,v)), + request: streamedResponse.request, + isRedirect: streamedResponse.isRedirect, + persistentConnection: streamedResponse.persistentConnection, + reasonPhrase: streamedResponse.reasonPhrase, + ); + } else { + return await http.Response.fromStream(streamedResponse); + } } } diff --git a/lib/src/enums/adapter.dart b/lib/src/enums/adapter.dart index b63e686c..3b92df32 100644 --- a/lib/src/enums/adapter.dart +++ b/lib/src/enums/adapter.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum Adapter { - xstatic(value: 'static'), - ssr(value: 'ssr'); + xstatic(value: 'static'), + ssr(value: 'ssr'); - const Adapter({required this.value}); + const Adapter({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/attribute_status.dart b/lib/src/enums/attribute_status.dart index baee982b..e81b83d3 100644 --- a/lib/src/enums/attribute_status.dart +++ b/lib/src/enums/attribute_status.dart @@ -1,15 +1,17 @@ part of '../../enums.dart'; enum AttributeStatus { - available(value: 'available'), - processing(value: 'processing'), - deleting(value: 'deleting'), - stuck(value: 'stuck'), - failed(value: 'failed'); + available(value: 'available'), + processing(value: 'processing'), + deleting(value: 'deleting'), + stuck(value: 'stuck'), + failed(value: 'failed'); - const AttributeStatus({required this.value}); + const AttributeStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/authentication_factor.dart b/lib/src/enums/authentication_factor.dart index 1d5271eb..00d12830 100644 --- a/lib/src/enums/authentication_factor.dart +++ b/lib/src/enums/authentication_factor.dart @@ -1,14 +1,16 @@ part of '../../enums.dart'; enum AuthenticationFactor { - email(value: 'email'), - phone(value: 'phone'), - totp(value: 'totp'), - recoverycode(value: 'recoverycode'); + email(value: 'email'), + phone(value: 'phone'), + totp(value: 'totp'), + recoverycode(value: 'recoverycode'); - const AuthenticationFactor({required this.value}); + const AuthenticationFactor({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/authenticator_type.dart b/lib/src/enums/authenticator_type.dart index c1fe8584..10460393 100644 --- a/lib/src/enums/authenticator_type.dart +++ b/lib/src/enums/authenticator_type.dart @@ -1,11 +1,13 @@ part of '../../enums.dart'; enum AuthenticatorType { - totp(value: 'totp'); + totp(value: 'totp'); - const AuthenticatorType({required this.value}); + const AuthenticatorType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/backup_services.dart b/lib/src/enums/backup_services.dart index 8bdf087a..34edd6b7 100644 --- a/lib/src/enums/backup_services.dart +++ b/lib/src/enums/backup_services.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum BackupServices { - databases(value: 'databases'), - tablesdb(value: 'tablesdb'), - documentsdb(value: 'documentsdb'), - vectorsdb(value: 'vectorsdb'), - functions(value: 'functions'), - storage(value: 'storage'); + databases(value: 'databases'), + tablesdb(value: 'tablesdb'), + documentsdb(value: 'documentsdb'), + vectorsdb(value: 'vectorsdb'), + functions(value: 'functions'), + storage(value: 'storage'); - const BackupServices({required this.value}); + const BackupServices({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/browser.dart b/lib/src/enums/browser.dart index 949f4c47..386fa11d 100644 --- a/lib/src/enums/browser.dart +++ b/lib/src/enums/browser.dart @@ -1,24 +1,26 @@ part of '../../enums.dart'; enum Browser { - avantBrowser(value: 'aa'), - androidWebViewBeta(value: 'an'), - googleChrome(value: 'ch'), - googleChromeIOS(value: 'ci'), - googleChromeMobile(value: 'cm'), - chromium(value: 'cr'), - mozillaFirefox(value: 'ff'), - safari(value: 'sf'), - mobileSafari(value: 'mf'), - microsoftEdge(value: 'ps'), - microsoftEdgeIOS(value: 'oi'), - operaMini(value: 'om'), - opera(value: 'op'), - operaNext(value: 'on'); + avantBrowser(value: 'aa'), + androidWebViewBeta(value: 'an'), + googleChrome(value: 'ch'), + googleChromeIOS(value: 'ci'), + googleChromeMobile(value: 'cm'), + chromium(value: 'cr'), + mozillaFirefox(value: 'ff'), + safari(value: 'sf'), + mobileSafari(value: 'mf'), + microsoftEdge(value: 'ps'), + microsoftEdgeIOS(value: 'oi'), + operaMini(value: 'om'), + opera(value: 'op'), + operaNext(value: 'on'); - const Browser({required this.value}); + const Browser({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/browser_permission.dart b/lib/src/enums/browser_permission.dart index fb4983db..765b3e0c 100644 --- a/lib/src/enums/browser_permission.dart +++ b/lib/src/enums/browser_permission.dart @@ -1,30 +1,32 @@ part of '../../enums.dart'; enum BrowserPermission { - geolocation(value: 'geolocation'), - camera(value: 'camera'), - microphone(value: 'microphone'), - notifications(value: 'notifications'), - midi(value: 'midi'), - push(value: 'push'), - clipboardRead(value: 'clipboard-read'), - clipboardWrite(value: 'clipboard-write'), - paymentHandler(value: 'payment-handler'), - usb(value: 'usb'), - bluetooth(value: 'bluetooth'), - accelerometer(value: 'accelerometer'), - gyroscope(value: 'gyroscope'), - magnetometer(value: 'magnetometer'), - ambientLightSensor(value: 'ambient-light-sensor'), - backgroundSync(value: 'background-sync'), - persistentStorage(value: 'persistent-storage'), - screenWakeLock(value: 'screen-wake-lock'), - webShare(value: 'web-share'), - xrSpatialTracking(value: 'xr-spatial-tracking'); + geolocation(value: 'geolocation'), + camera(value: 'camera'), + microphone(value: 'microphone'), + notifications(value: 'notifications'), + midi(value: 'midi'), + push(value: 'push'), + clipboardRead(value: 'clipboard-read'), + clipboardWrite(value: 'clipboard-write'), + paymentHandler(value: 'payment-handler'), + usb(value: 'usb'), + bluetooth(value: 'bluetooth'), + accelerometer(value: 'accelerometer'), + gyroscope(value: 'gyroscope'), + magnetometer(value: 'magnetometer'), + ambientLightSensor(value: 'ambient-light-sensor'), + backgroundSync(value: 'background-sync'), + persistentStorage(value: 'persistent-storage'), + screenWakeLock(value: 'screen-wake-lock'), + webShare(value: 'web-share'), + xrSpatialTracking(value: 'xr-spatial-tracking'); - const BrowserPermission({required this.value}); + const BrowserPermission({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/build_runtime.dart b/lib/src/enums/build_runtime.dart index df242bdf..70967c22 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,98 +1,101 @@ part of '../../enums.dart'; enum BuildRuntime { - node145(value: 'node-14.5'), - node160(value: 'node-16.0'), - node180(value: 'node-18.0'), - node190(value: 'node-19.0'), - node200(value: 'node-20.0'), - node210(value: 'node-21.0'), - node22(value: 'node-22'), - node23(value: 'node-23'), - node24(value: 'node-24'), - node25(value: 'node-25'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - php84(value: 'php-8.4'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - ruby34(value: 'ruby-3.4'), - ruby40(value: 'ruby-4.0'), - python38(value: 'python-3.8'), - python39(value: 'python-3.9'), - python310(value: 'python-3.10'), - python311(value: 'python-3.11'), - python312(value: 'python-3.12'), - python313(value: 'python-3.13'), - python314(value: 'python-3.14'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - pythonMl313(value: 'python-ml-3.13'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - deno25(value: 'deno-2.5'), - deno26(value: 'deno-2.6'), - dart215(value: 'dart-2.15'), - dart216(value: 'dart-2.16'), - dart217(value: 'dart-2.17'), - dart218(value: 'dart-2.18'), - dart219(value: 'dart-2.19'), - dart30(value: 'dart-3.0'), - dart31(value: 'dart-3.1'), - dart33(value: 'dart-3.3'), - dart35(value: 'dart-3.5'), - dart38(value: 'dart-3.8'), - dart39(value: 'dart-3.9'), - dart310(value: 'dart-3.10'), - dart311(value: 'dart-3.11'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - dotnet10(value: 'dotnet-10'), - java80(value: 'java-8.0'), - java110(value: 'java-11.0'), - java170(value: 'java-17.0'), - java180(value: 'java-18.0'), - java210(value: 'java-21.0'), - java22(value: 'java-22'), - java25(value: 'java-25'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - swift62(value: 'swift-6.2'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - kotlin23(value: 'kotlin-2.3'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - bun12(value: 'bun-1.2'), - bun13(value: 'bun-1.3'), - go123(value: 'go-1.23'), - go124(value: 'go-1.24'), - go125(value: 'go-1.25'), - go126(value: 'go-1.26'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'), - flutter335(value: 'flutter-3.35'), - flutter338(value: 'flutter-3.38'), - flutter341(value: 'flutter-3.41'); + node145(value: 'node-14.5'), + node160(value: 'node-16.0'), + node180(value: 'node-18.0'), + node190(value: 'node-19.0'), + node200(value: 'node-20.0'), + node210(value: 'node-21.0'), + node22(value: 'node-22'), + node23(value: 'node-23'), + node24(value: 'node-24'), + node25(value: 'node-25'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + php84(value: 'php-8.4'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + ruby34(value: 'ruby-3.4'), + ruby40(value: 'ruby-4.0'), + python38(value: 'python-3.8'), + python39(value: 'python-3.9'), + python310(value: 'python-3.10'), + python311(value: 'python-3.11'), + python312(value: 'python-3.12'), + python313(value: 'python-3.13'), + python314(value: 'python-3.14'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + pythonMl313(value: 'python-ml-3.13'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + deno25(value: 'deno-2.5'), + deno26(value: 'deno-2.6'), + dart215(value: 'dart-2.15'), + dart216(value: 'dart-2.16'), + dart217(value: 'dart-2.17'), + dart218(value: 'dart-2.18'), + dart219(value: 'dart-2.19'), + dart30(value: 'dart-3.0'), + dart31(value: 'dart-3.1'), + dart33(value: 'dart-3.3'), + dart35(value: 'dart-3.5'), + dart38(value: 'dart-3.8'), + dart39(value: 'dart-3.9'), + dart310(value: 'dart-3.10'), + dart311(value: 'dart-3.11'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + dotnet10(value: 'dotnet-10'), + java80(value: 'java-8.0'), + java110(value: 'java-11.0'), + java170(value: 'java-17.0'), + java180(value: 'java-18.0'), + java210(value: 'java-21.0'), + java22(value: 'java-22'), + java25(value: 'java-25'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + swift62(value: 'swift-6.2'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + kotlin23(value: 'kotlin-2.3'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + bun12(value: 'bun-1.2'), + bun13(value: 'bun-1.3'), + go123(value: 'go-1.23'), + go124(value: 'go-1.24'), + go125(value: 'go-1.25'), + go126(value: 'go-1.26'), + rust183(value: 'rust-1.83'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'), + flutter335(value: 'flutter-3.35'), + flutter338(value: 'flutter-3.38'), + flutter341(value: 'flutter-3.41'); - const BuildRuntime({required this.value}); + const BuildRuntime({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/column_status.dart b/lib/src/enums/column_status.dart index 2800e7f8..22267346 100644 --- a/lib/src/enums/column_status.dart +++ b/lib/src/enums/column_status.dart @@ -1,15 +1,17 @@ part of '../../enums.dart'; enum ColumnStatus { - available(value: 'available'), - processing(value: 'processing'), - deleting(value: 'deleting'), - stuck(value: 'stuck'), - failed(value: 'failed'); + available(value: 'available'), + processing(value: 'processing'), + deleting(value: 'deleting'), + stuck(value: 'stuck'), + failed(value: 'failed'); - const ColumnStatus({required this.value}); + const ColumnStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/compression.dart b/lib/src/enums/compression.dart index 768930d9..209acfb8 100644 --- a/lib/src/enums/compression.dart +++ b/lib/src/enums/compression.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum Compression { - none(value: 'none'), - gzip(value: 'gzip'), - zstd(value: 'zstd'); + none(value: 'none'), + gzip(value: 'gzip'), + zstd(value: 'zstd'); - const Compression({required this.value}); + const Compression({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/credit_card.dart b/lib/src/enums/credit_card.dart index 28c2a1b3..4d6bce3a 100644 --- a/lib/src/enums/credit_card.dart +++ b/lib/src/enums/credit_card.dart @@ -1,27 +1,29 @@ part of '../../enums.dart'; enum CreditCard { - americanExpress(value: 'amex'), - argencard(value: 'argencard'), - cabal(value: 'cabal'), - cencosud(value: 'cencosud'), - dinersClub(value: 'diners'), - discover(value: 'discover'), - elo(value: 'elo'), - hipercard(value: 'hipercard'), - jCB(value: 'jcb'), - mastercard(value: 'mastercard'), - naranja(value: 'naranja'), - tarjetaShopping(value: 'targeta-shopping'), - unionPay(value: 'unionpay'), - visa(value: 'visa'), - mIR(value: 'mir'), - maestro(value: 'maestro'), - rupay(value: 'rupay'); + americanExpress(value: 'amex'), + argencard(value: 'argencard'), + cabal(value: 'cabal'), + cencosud(value: 'cencosud'), + dinersClub(value: 'diners'), + discover(value: 'discover'), + elo(value: 'elo'), + hipercard(value: 'hipercard'), + jCB(value: 'jcb'), + mastercard(value: 'mastercard'), + naranja(value: 'naranja'), + tarjetaShopping(value: 'targeta-shopping'), + unionPay(value: 'unionpay'), + visa(value: 'visa'), + mIR(value: 'mir'), + maestro(value: 'maestro'), + rupay(value: 'rupay'); - const CreditCard({required this.value}); + const CreditCard({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/database_type.dart b/lib/src/enums/database_type.dart index c6887ffc..28189091 100644 --- a/lib/src/enums/database_type.dart +++ b/lib/src/enums/database_type.dart @@ -1,14 +1,16 @@ part of '../../enums.dart'; enum DatabaseType { - legacy(value: 'legacy'), - tablesdb(value: 'tablesdb'), - documentsdb(value: 'documentsdb'), - vectorsdb(value: 'vectorsdb'); + legacy(value: 'legacy'), + tablesdb(value: 'tablesdb'), + documentsdb(value: 'documentsdb'), + vectorsdb(value: 'vectorsdb'); - const DatabaseType({required this.value}); + const DatabaseType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/databases_index_type.dart b/lib/src/enums/databases_index_type.dart index 1ae29cf6..c7212764 100644 --- a/lib/src/enums/databases_index_type.dart +++ b/lib/src/enums/databases_index_type.dart @@ -1,14 +1,16 @@ part of '../../enums.dart'; enum DatabasesIndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'), - spatial(value: 'spatial'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'), + spatial(value: 'spatial'); - const DatabasesIndexType({required this.value}); + const DatabasesIndexType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/deployment_download_type.dart b/lib/src/enums/deployment_download_type.dart index 1788f892..782b30c7 100644 --- a/lib/src/enums/deployment_download_type.dart +++ b/lib/src/enums/deployment_download_type.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum DeploymentDownloadType { - source(value: 'source'), - output(value: 'output'); + source(value: 'source'), + output(value: 'output'); - const DeploymentDownloadType({required this.value}); + const DeploymentDownloadType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/deployment_status.dart b/lib/src/enums/deployment_status.dart index ed0aa57f..c6087eb2 100644 --- a/lib/src/enums/deployment_status.dart +++ b/lib/src/enums/deployment_status.dart @@ -1,16 +1,18 @@ part of '../../enums.dart'; enum DeploymentStatus { - waiting(value: 'waiting'), - processing(value: 'processing'), - building(value: 'building'), - ready(value: 'ready'), - canceled(value: 'canceled'), - failed(value: 'failed'); + waiting(value: 'waiting'), + processing(value: 'processing'), + building(value: 'building'), + ready(value: 'ready'), + canceled(value: 'canceled'), + failed(value: 'failed'); - const DeploymentStatus({required this.value}); + const DeploymentStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/email_template_locale.dart b/lib/src/enums/email_template_locale.dart new file mode 100644 index 00000000..26766a5b --- /dev/null +++ b/lib/src/enums/email_template_locale.dart @@ -0,0 +1,143 @@ +part of '../../enums.dart'; + +enum EmailTemplateLocale { + af(value: 'af'), + arAe(value: 'ar-ae'), + arBh(value: 'ar-bh'), + arDz(value: 'ar-dz'), + arEg(value: 'ar-eg'), + arIq(value: 'ar-iq'), + arJo(value: 'ar-jo'), + arKw(value: 'ar-kw'), + arLb(value: 'ar-lb'), + arLy(value: 'ar-ly'), + arMa(value: 'ar-ma'), + arOm(value: 'ar-om'), + arQa(value: 'ar-qa'), + arSa(value: 'ar-sa'), + arSy(value: 'ar-sy'), + arTn(value: 'ar-tn'), + arYe(value: 'ar-ye'), + xas(value: 'as'), + az(value: 'az'), + be(value: 'be'), + bg(value: 'bg'), + bh(value: 'bh'), + bn(value: 'bn'), + bs(value: 'bs'), + ca(value: 'ca'), + cs(value: 'cs'), + cy(value: 'cy'), + da(value: 'da'), + de(value: 'de'), + deAt(value: 'de-at'), + deCh(value: 'de-ch'), + deLi(value: 'de-li'), + deLu(value: 'de-lu'), + el(value: 'el'), + en(value: 'en'), + enAu(value: 'en-au'), + enBz(value: 'en-bz'), + enCa(value: 'en-ca'), + enGb(value: 'en-gb'), + enIe(value: 'en-ie'), + enJm(value: 'en-jm'), + enNz(value: 'en-nz'), + enTt(value: 'en-tt'), + enUs(value: 'en-us'), + enZa(value: 'en-za'), + eo(value: 'eo'), + es(value: 'es'), + esAr(value: 'es-ar'), + esBo(value: 'es-bo'), + esCl(value: 'es-cl'), + esCo(value: 'es-co'), + esCr(value: 'es-cr'), + esDo(value: 'es-do'), + esEc(value: 'es-ec'), + esGt(value: 'es-gt'), + esHn(value: 'es-hn'), + esMx(value: 'es-mx'), + esNi(value: 'es-ni'), + esPa(value: 'es-pa'), + esPe(value: 'es-pe'), + esPr(value: 'es-pr'), + esPy(value: 'es-py'), + esSv(value: 'es-sv'), + esUy(value: 'es-uy'), + esVe(value: 'es-ve'), + et(value: 'et'), + eu(value: 'eu'), + fa(value: 'fa'), + fi(value: 'fi'), + fo(value: 'fo'), + fr(value: 'fr'), + frBe(value: 'fr-be'), + frCa(value: 'fr-ca'), + frCh(value: 'fr-ch'), + frLu(value: 'fr-lu'), + ga(value: 'ga'), + gd(value: 'gd'), + he(value: 'he'), + hi(value: 'hi'), + hr(value: 'hr'), + hu(value: 'hu'), + id(value: 'id'), + xis(value: 'is'), + it(value: 'it'), + itCh(value: 'it-ch'), + ja(value: 'ja'), + ji(value: 'ji'), + ko(value: 'ko'), + ku(value: 'ku'), + lt(value: 'lt'), + lv(value: 'lv'), + mk(value: 'mk'), + ml(value: 'ml'), + ms(value: 'ms'), + mt(value: 'mt'), + nb(value: 'nb'), + ne(value: 'ne'), + nl(value: 'nl'), + nlBe(value: 'nl-be'), + nn(value: 'nn'), + no(value: 'no'), + pa(value: 'pa'), + pl(value: 'pl'), + pt(value: 'pt'), + ptBr(value: 'pt-br'), + rm(value: 'rm'), + ro(value: 'ro'), + roMd(value: 'ro-md'), + ru(value: 'ru'), + ruMd(value: 'ru-md'), + sb(value: 'sb'), + sk(value: 'sk'), + sl(value: 'sl'), + sq(value: 'sq'), + sr(value: 'sr'), + sv(value: 'sv'), + svFi(value: 'sv-fi'), + th(value: 'th'), + tn(value: 'tn'), + tr(value: 'tr'), + ts(value: 'ts'), + ua(value: 'ua'), + ur(value: 'ur'), + ve(value: 've'), + vi(value: 'vi'), + xh(value: 'xh'), + zhCn(value: 'zh-cn'), + zhHk(value: 'zh-hk'), + zhSg(value: 'zh-sg'), + zhTw(value: 'zh-tw'), + zu(value: 'zu'); + + const EmailTemplateLocale({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/email_template_type.dart b/lib/src/enums/email_template_type.dart new file mode 100644 index 00000000..ee291f99 --- /dev/null +++ b/lib/src/enums/email_template_type.dart @@ -0,0 +1,19 @@ +part of '../../enums.dart'; + +enum EmailTemplateType { + verification(value: 'verification'), + magicSession(value: 'magicSession'), + recovery(value: 'recovery'), + invitation(value: 'invitation'), + mfaChallenge(value: 'mfaChallenge'), + sessionAlert(value: 'sessionAlert'), + otpSession(value: 'otpSession'); + + const EmailTemplateType({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/execution_method.dart b/lib/src/enums/execution_method.dart index 44de4907..6ad112fe 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,17 +1,19 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'), - hEAD(value: 'HEAD'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'), + hEAD(value: 'HEAD'); - const ExecutionMethod({required this.value}); + const ExecutionMethod({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/execution_status.dart b/lib/src/enums/execution_status.dart index 7ea9865e..f54859c9 100644 --- a/lib/src/enums/execution_status.dart +++ b/lib/src/enums/execution_status.dart @@ -1,15 +1,17 @@ part of '../../enums.dart'; enum ExecutionStatus { - waiting(value: 'waiting'), - processing(value: 'processing'), - completed(value: 'completed'), - failed(value: 'failed'), - scheduled(value: 'scheduled'); + waiting(value: 'waiting'), + processing(value: 'processing'), + completed(value: 'completed'), + failed(value: 'failed'), + scheduled(value: 'scheduled'); - const ExecutionStatus({required this.value}); + const ExecutionStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/execution_trigger.dart b/lib/src/enums/execution_trigger.dart index fb05eb7d..8a14ae60 100644 --- a/lib/src/enums/execution_trigger.dart +++ b/lib/src/enums/execution_trigger.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum ExecutionTrigger { - http(value: 'http'), - schedule(value: 'schedule'), - event(value: 'event'); + http(value: 'http'), + schedule(value: 'schedule'), + event(value: 'event'); - const ExecutionTrigger({required this.value}); + const ExecutionTrigger({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/flag.dart b/lib/src/enums/flag.dart index a44cb81d..27c25cac 100644 --- a/lib/src/enums/flag.dart +++ b/lib/src/enums/flag.dart @@ -1,205 +1,207 @@ part of '../../enums.dart'; enum Flag { - afghanistan(value: 'af'), - angola(value: 'ao'), - albania(value: 'al'), - andorra(value: 'ad'), - unitedArabEmirates(value: 'ae'), - argentina(value: 'ar'), - armenia(value: 'am'), - antiguaAndBarbuda(value: 'ag'), - australia(value: 'au'), - austria(value: 'at'), - azerbaijan(value: 'az'), - burundi(value: 'bi'), - belgium(value: 'be'), - benin(value: 'bj'), - burkinaFaso(value: 'bf'), - bangladesh(value: 'bd'), - bulgaria(value: 'bg'), - bahrain(value: 'bh'), - bahamas(value: 'bs'), - bosniaAndHerzegovina(value: 'ba'), - belarus(value: 'by'), - belize(value: 'bz'), - bolivia(value: 'bo'), - brazil(value: 'br'), - barbados(value: 'bb'), - bruneiDarussalam(value: 'bn'), - bhutan(value: 'bt'), - botswana(value: 'bw'), - centralAfricanRepublic(value: 'cf'), - canada(value: 'ca'), - switzerland(value: 'ch'), - chile(value: 'cl'), - china(value: 'cn'), - coteDIvoire(value: 'ci'), - cameroon(value: 'cm'), - democraticRepublicOfTheCongo(value: 'cd'), - republicOfTheCongo(value: 'cg'), - colombia(value: 'co'), - comoros(value: 'km'), - capeVerde(value: 'cv'), - costaRica(value: 'cr'), - cuba(value: 'cu'), - cyprus(value: 'cy'), - czechRepublic(value: 'cz'), - germany(value: 'de'), - djibouti(value: 'dj'), - dominica(value: 'dm'), - denmark(value: 'dk'), - dominicanRepublic(value: 'do'), - algeria(value: 'dz'), - ecuador(value: 'ec'), - egypt(value: 'eg'), - eritrea(value: 'er'), - spain(value: 'es'), - estonia(value: 'ee'), - ethiopia(value: 'et'), - finland(value: 'fi'), - fiji(value: 'fj'), - france(value: 'fr'), - micronesiaFederatedStatesOf(value: 'fm'), - gabon(value: 'ga'), - unitedKingdom(value: 'gb'), - georgia(value: 'ge'), - ghana(value: 'gh'), - guinea(value: 'gn'), - gambia(value: 'gm'), - guineaBissau(value: 'gw'), - equatorialGuinea(value: 'gq'), - greece(value: 'gr'), - grenada(value: 'gd'), - guatemala(value: 'gt'), - guyana(value: 'gy'), - honduras(value: 'hn'), - croatia(value: 'hr'), - haiti(value: 'ht'), - hungary(value: 'hu'), - indonesia(value: 'id'), - india(value: 'in'), - ireland(value: 'ie'), - iranIslamicRepublicOf(value: 'ir'), - iraq(value: 'iq'), - iceland(value: 'is'), - israel(value: 'il'), - italy(value: 'it'), - jamaica(value: 'jm'), - jordan(value: 'jo'), - japan(value: 'jp'), - kazakhstan(value: 'kz'), - kenya(value: 'ke'), - kyrgyzstan(value: 'kg'), - cambodia(value: 'kh'), - kiribati(value: 'ki'), - saintKittsAndNevis(value: 'kn'), - southKorea(value: 'kr'), - kuwait(value: 'kw'), - laoPeopleSDemocraticRepublic(value: 'la'), - lebanon(value: 'lb'), - liberia(value: 'lr'), - libya(value: 'ly'), - saintLucia(value: 'lc'), - liechtenstein(value: 'li'), - sriLanka(value: 'lk'), - lesotho(value: 'ls'), - lithuania(value: 'lt'), - luxembourg(value: 'lu'), - latvia(value: 'lv'), - morocco(value: 'ma'), - monaco(value: 'mc'), - moldova(value: 'md'), - madagascar(value: 'mg'), - maldives(value: 'mv'), - mexico(value: 'mx'), - marshallIslands(value: 'mh'), - northMacedonia(value: 'mk'), - mali(value: 'ml'), - malta(value: 'mt'), - myanmar(value: 'mm'), - montenegro(value: 'me'), - mongolia(value: 'mn'), - mozambique(value: 'mz'), - mauritania(value: 'mr'), - mauritius(value: 'mu'), - malawi(value: 'mw'), - malaysia(value: 'my'), - namibia(value: 'na'), - niger(value: 'ne'), - nigeria(value: 'ng'), - nicaragua(value: 'ni'), - netherlands(value: 'nl'), - norway(value: 'no'), - nepal(value: 'np'), - nauru(value: 'nr'), - newZealand(value: 'nz'), - oman(value: 'om'), - pakistan(value: 'pk'), - panama(value: 'pa'), - peru(value: 'pe'), - philippines(value: 'ph'), - palau(value: 'pw'), - papuaNewGuinea(value: 'pg'), - poland(value: 'pl'), - frenchPolynesia(value: 'pf'), - northKorea(value: 'kp'), - portugal(value: 'pt'), - paraguay(value: 'py'), - qatar(value: 'qa'), - romania(value: 'ro'), - russia(value: 'ru'), - rwanda(value: 'rw'), - saudiArabia(value: 'sa'), - sudan(value: 'sd'), - senegal(value: 'sn'), - singapore(value: 'sg'), - solomonIslands(value: 'sb'), - sierraLeone(value: 'sl'), - elSalvador(value: 'sv'), - sanMarino(value: 'sm'), - somalia(value: 'so'), - serbia(value: 'rs'), - southSudan(value: 'ss'), - saoTomeAndPrincipe(value: 'st'), - suriname(value: 'sr'), - slovakia(value: 'sk'), - slovenia(value: 'si'), - sweden(value: 'se'), - eswatini(value: 'sz'), - seychelles(value: 'sc'), - syria(value: 'sy'), - chad(value: 'td'), - togo(value: 'tg'), - thailand(value: 'th'), - tajikistan(value: 'tj'), - turkmenistan(value: 'tm'), - timorLeste(value: 'tl'), - tonga(value: 'to'), - trinidadAndTobago(value: 'tt'), - tunisia(value: 'tn'), - turkey(value: 'tr'), - tuvalu(value: 'tv'), - tanzania(value: 'tz'), - uganda(value: 'ug'), - ukraine(value: 'ua'), - uruguay(value: 'uy'), - unitedStates(value: 'us'), - uzbekistan(value: 'uz'), - vaticanCity(value: 'va'), - saintVincentAndTheGrenadines(value: 'vc'), - venezuela(value: 've'), - vietnam(value: 'vn'), - vanuatu(value: 'vu'), - samoa(value: 'ws'), - yemen(value: 'ye'), - southAfrica(value: 'za'), - zambia(value: 'zm'), - zimbabwe(value: 'zw'); + afghanistan(value: 'af'), + angola(value: 'ao'), + albania(value: 'al'), + andorra(value: 'ad'), + unitedArabEmirates(value: 'ae'), + argentina(value: 'ar'), + armenia(value: 'am'), + antiguaAndBarbuda(value: 'ag'), + australia(value: 'au'), + austria(value: 'at'), + azerbaijan(value: 'az'), + burundi(value: 'bi'), + belgium(value: 'be'), + benin(value: 'bj'), + burkinaFaso(value: 'bf'), + bangladesh(value: 'bd'), + bulgaria(value: 'bg'), + bahrain(value: 'bh'), + bahamas(value: 'bs'), + bosniaAndHerzegovina(value: 'ba'), + belarus(value: 'by'), + belize(value: 'bz'), + bolivia(value: 'bo'), + brazil(value: 'br'), + barbados(value: 'bb'), + bruneiDarussalam(value: 'bn'), + bhutan(value: 'bt'), + botswana(value: 'bw'), + centralAfricanRepublic(value: 'cf'), + canada(value: 'ca'), + switzerland(value: 'ch'), + chile(value: 'cl'), + china(value: 'cn'), + coteDIvoire(value: 'ci'), + cameroon(value: 'cm'), + democraticRepublicOfTheCongo(value: 'cd'), + republicOfTheCongo(value: 'cg'), + colombia(value: 'co'), + comoros(value: 'km'), + capeVerde(value: 'cv'), + costaRica(value: 'cr'), + cuba(value: 'cu'), + cyprus(value: 'cy'), + czechRepublic(value: 'cz'), + germany(value: 'de'), + djibouti(value: 'dj'), + dominica(value: 'dm'), + denmark(value: 'dk'), + dominicanRepublic(value: 'do'), + algeria(value: 'dz'), + ecuador(value: 'ec'), + egypt(value: 'eg'), + eritrea(value: 'er'), + spain(value: 'es'), + estonia(value: 'ee'), + ethiopia(value: 'et'), + finland(value: 'fi'), + fiji(value: 'fj'), + france(value: 'fr'), + micronesiaFederatedStatesOf(value: 'fm'), + gabon(value: 'ga'), + unitedKingdom(value: 'gb'), + georgia(value: 'ge'), + ghana(value: 'gh'), + guinea(value: 'gn'), + gambia(value: 'gm'), + guineaBissau(value: 'gw'), + equatorialGuinea(value: 'gq'), + greece(value: 'gr'), + grenada(value: 'gd'), + guatemala(value: 'gt'), + guyana(value: 'gy'), + honduras(value: 'hn'), + croatia(value: 'hr'), + haiti(value: 'ht'), + hungary(value: 'hu'), + indonesia(value: 'id'), + india(value: 'in'), + ireland(value: 'ie'), + iranIslamicRepublicOf(value: 'ir'), + iraq(value: 'iq'), + iceland(value: 'is'), + israel(value: 'il'), + italy(value: 'it'), + jamaica(value: 'jm'), + jordan(value: 'jo'), + japan(value: 'jp'), + kazakhstan(value: 'kz'), + kenya(value: 'ke'), + kyrgyzstan(value: 'kg'), + cambodia(value: 'kh'), + kiribati(value: 'ki'), + saintKittsAndNevis(value: 'kn'), + southKorea(value: 'kr'), + kuwait(value: 'kw'), + laoPeopleSDemocraticRepublic(value: 'la'), + lebanon(value: 'lb'), + liberia(value: 'lr'), + libya(value: 'ly'), + saintLucia(value: 'lc'), + liechtenstein(value: 'li'), + sriLanka(value: 'lk'), + lesotho(value: 'ls'), + lithuania(value: 'lt'), + luxembourg(value: 'lu'), + latvia(value: 'lv'), + morocco(value: 'ma'), + monaco(value: 'mc'), + moldova(value: 'md'), + madagascar(value: 'mg'), + maldives(value: 'mv'), + mexico(value: 'mx'), + marshallIslands(value: 'mh'), + northMacedonia(value: 'mk'), + mali(value: 'ml'), + malta(value: 'mt'), + myanmar(value: 'mm'), + montenegro(value: 'me'), + mongolia(value: 'mn'), + mozambique(value: 'mz'), + mauritania(value: 'mr'), + mauritius(value: 'mu'), + malawi(value: 'mw'), + malaysia(value: 'my'), + namibia(value: 'na'), + niger(value: 'ne'), + nigeria(value: 'ng'), + nicaragua(value: 'ni'), + netherlands(value: 'nl'), + norway(value: 'no'), + nepal(value: 'np'), + nauru(value: 'nr'), + newZealand(value: 'nz'), + oman(value: 'om'), + pakistan(value: 'pk'), + panama(value: 'pa'), + peru(value: 'pe'), + philippines(value: 'ph'), + palau(value: 'pw'), + papuaNewGuinea(value: 'pg'), + poland(value: 'pl'), + frenchPolynesia(value: 'pf'), + northKorea(value: 'kp'), + portugal(value: 'pt'), + paraguay(value: 'py'), + qatar(value: 'qa'), + romania(value: 'ro'), + russia(value: 'ru'), + rwanda(value: 'rw'), + saudiArabia(value: 'sa'), + sudan(value: 'sd'), + senegal(value: 'sn'), + singapore(value: 'sg'), + solomonIslands(value: 'sb'), + sierraLeone(value: 'sl'), + elSalvador(value: 'sv'), + sanMarino(value: 'sm'), + somalia(value: 'so'), + serbia(value: 'rs'), + southSudan(value: 'ss'), + saoTomeAndPrincipe(value: 'st'), + suriname(value: 'sr'), + slovakia(value: 'sk'), + slovenia(value: 'si'), + sweden(value: 'se'), + eswatini(value: 'sz'), + seychelles(value: 'sc'), + syria(value: 'sy'), + chad(value: 'td'), + togo(value: 'tg'), + thailand(value: 'th'), + tajikistan(value: 'tj'), + turkmenistan(value: 'tm'), + timorLeste(value: 'tl'), + tonga(value: 'to'), + trinidadAndTobago(value: 'tt'), + tunisia(value: 'tn'), + turkey(value: 'tr'), + tuvalu(value: 'tv'), + tanzania(value: 'tz'), + uganda(value: 'ug'), + ukraine(value: 'ua'), + uruguay(value: 'uy'), + unitedStates(value: 'us'), + uzbekistan(value: 'uz'), + vaticanCity(value: 'va'), + saintVincentAndTheGrenadines(value: 'vc'), + venezuela(value: 've'), + vietnam(value: 'vn'), + vanuatu(value: 'vu'), + samoa(value: 'ws'), + yemen(value: 'ye'), + southAfrica(value: 'za'), + zambia(value: 'zm'), + zimbabwe(value: 'zw'); - const Flag({required this.value}); + const Flag({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/framework.dart b/lib/src/enums/framework.dart index a51b8580..03e25bed 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,25 +1,27 @@ part of '../../enums.dart'; enum Framework { - analog(value: 'analog'), - angular(value: 'angular'), - nextjs(value: 'nextjs'), - react(value: 'react'), - nuxt(value: 'nuxt'), - vue(value: 'vue'), - sveltekit(value: 'sveltekit'), - astro(value: 'astro'), - tanstackStart(value: 'tanstack-start'), - remix(value: 'remix'), - lynx(value: 'lynx'), - flutter(value: 'flutter'), - reactNative(value: 'react-native'), - vite(value: 'vite'), - other(value: 'other'); + analog(value: 'analog'), + angular(value: 'angular'), + nextjs(value: 'nextjs'), + react(value: 'react'), + nuxt(value: 'nuxt'), + vue(value: 'vue'), + sveltekit(value: 'sveltekit'), + astro(value: 'astro'), + tanstackStart(value: 'tanstack-start'), + remix(value: 'remix'), + lynx(value: 'lynx'), + flutter(value: 'flutter'), + reactNative(value: 'react-native'), + vite(value: 'vite'), + other(value: 'other'); - const Framework({required this.value}); + const Framework({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/health_antivirus_status.dart b/lib/src/enums/health_antivirus_status.dart index 939e0f7d..57b3cd9d 100644 --- a/lib/src/enums/health_antivirus_status.dart +++ b/lib/src/enums/health_antivirus_status.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum HealthAntivirusStatus { - disabled(value: 'disabled'), - offline(value: 'offline'), - online(value: 'online'); + disabled(value: 'disabled'), + offline(value: 'offline'), + online(value: 'online'); - const HealthAntivirusStatus({required this.value}); + const HealthAntivirusStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/health_check_status.dart b/lib/src/enums/health_check_status.dart index f21e793a..c20cdc7c 100644 --- a/lib/src/enums/health_check_status.dart +++ b/lib/src/enums/health_check_status.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum HealthCheckStatus { - pass(value: 'pass'), - fail(value: 'fail'); + pass(value: 'pass'), + fail(value: 'fail'); - const HealthCheckStatus({required this.value}); + const HealthCheckStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/image_format.dart b/lib/src/enums/image_format.dart index 55f4c5db..0f996ed9 100644 --- a/lib/src/enums/image_format.dart +++ b/lib/src/enums/image_format.dart @@ -1,17 +1,19 @@ part of '../../enums.dart'; enum ImageFormat { - jpg(value: 'jpg'), - jpeg(value: 'jpeg'), - png(value: 'png'), - webp(value: 'webp'), - heic(value: 'heic'), - avif(value: 'avif'), - gif(value: 'gif'); + jpg(value: 'jpg'), + jpeg(value: 'jpeg'), + png(value: 'png'), + webp(value: 'webp'), + heic(value: 'heic'), + avif(value: 'avif'), + gif(value: 'gif'); - const ImageFormat({required this.value}); + const ImageFormat({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/image_gravity.dart b/lib/src/enums/image_gravity.dart index 88029044..79bc4d62 100644 --- a/lib/src/enums/image_gravity.dart +++ b/lib/src/enums/image_gravity.dart @@ -1,19 +1,21 @@ part of '../../enums.dart'; enum ImageGravity { - center(value: 'center'), - topLeft(value: 'top-left'), - top(value: 'top'), - topRight(value: 'top-right'), - left(value: 'left'), - right(value: 'right'), - bottomLeft(value: 'bottom-left'), - bottom(value: 'bottom'), - bottomRight(value: 'bottom-right'); + center(value: 'center'), + topLeft(value: 'top-left'), + top(value: 'top'), + topRight(value: 'top-right'), + left(value: 'left'), + right(value: 'right'), + bottomLeft(value: 'bottom-left'), + bottom(value: 'bottom'), + bottomRight(value: 'bottom-right'); - const ImageGravity({required this.value}); + const ImageGravity({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/index_status.dart b/lib/src/enums/index_status.dart index ccd6473a..a1eef2e2 100644 --- a/lib/src/enums/index_status.dart +++ b/lib/src/enums/index_status.dart @@ -1,15 +1,17 @@ part of '../../enums.dart'; enum IndexStatus { - available(value: 'available'), - processing(value: 'processing'), - deleting(value: 'deleting'), - stuck(value: 'stuck'), - failed(value: 'failed'); + available(value: 'available'), + processing(value: 'processing'), + deleting(value: 'deleting'), + stuck(value: 'stuck'), + failed(value: 'failed'); - const IndexStatus({required this.value}); + const IndexStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/message_priority.dart b/lib/src/enums/message_priority.dart index a07e6f76..375913e8 100644 --- a/lib/src/enums/message_priority.dart +++ b/lib/src/enums/message_priority.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum MessagePriority { - normal(value: 'normal'), - high(value: 'high'); + normal(value: 'normal'), + high(value: 'high'); - const MessagePriority({required this.value}); + const MessagePriority({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/message_status.dart b/lib/src/enums/message_status.dart index e5ed35ce..836796ef 100644 --- a/lib/src/enums/message_status.dart +++ b/lib/src/enums/message_status.dart @@ -1,15 +1,17 @@ part of '../../enums.dart'; enum MessageStatus { - draft(value: 'draft'), - processing(value: 'processing'), - scheduled(value: 'scheduled'), - sent(value: 'sent'), - failed(value: 'failed'); + draft(value: 'draft'), + processing(value: 'processing'), + scheduled(value: 'scheduled'), + sent(value: 'sent'), + failed(value: 'failed'); - const MessageStatus({required this.value}); + const MessageStatus({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/messaging_provider_type.dart b/lib/src/enums/messaging_provider_type.dart index c69bf01e..a6859648 100644 --- a/lib/src/enums/messaging_provider_type.dart +++ b/lib/src/enums/messaging_provider_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum MessagingProviderType { - email(value: 'email'), - sms(value: 'sms'), - push(value: 'push'); + email(value: 'email'), + sms(value: 'sms'), + push(value: 'push'); - const MessagingProviderType({required this.value}); + const MessagingProviderType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/method_id.dart b/lib/src/enums/method_id.dart new file mode 100644 index 00000000..f2cd1cde --- /dev/null +++ b/lib/src/enums/method_id.dart @@ -0,0 +1,19 @@ +part of '../../enums.dart'; + +enum MethodId { + emailPassword(value: 'email-password'), + magicUrl(value: 'magic-url'), + emailOtp(value: 'email-otp'), + anonymous(value: 'anonymous'), + invites(value: 'invites'), + jwt(value: 'jwt'), + phone(value: 'phone'); + + const MethodId({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/name.dart b/lib/src/enums/name.dart index d45eb4ef..9c4a8a40 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,23 +1,25 @@ part of '../../enums.dart'; enum Name { - v1Database(value: 'v1-database'), - v1Deletes(value: 'v1-deletes'), - v1Audits(value: 'v1-audits'), - v1Mails(value: 'v1-mails'), - v1Functions(value: 'v1-functions'), - v1StatsResources(value: 'v1-stats-resources'), - v1StatsUsage(value: 'v1-stats-usage'), - v1Webhooks(value: 'v1-webhooks'), - v1Certificates(value: 'v1-certificates'), - v1Builds(value: 'v1-builds'), - v1Screenshots(value: 'v1-screenshots'), - v1Messaging(value: 'v1-messaging'), - v1Migrations(value: 'v1-migrations'); + v1Database(value: 'v1-database'), + v1Deletes(value: 'v1-deletes'), + v1Audits(value: 'v1-audits'), + v1Mails(value: 'v1-mails'), + v1Functions(value: 'v1-functions'), + v1StatsResources(value: 'v1-stats-resources'), + v1StatsUsage(value: 'v1-stats-usage'), + v1Webhooks(value: 'v1-webhooks'), + v1Certificates(value: 'v1-certificates'), + v1Builds(value: 'v1-builds'), + v1Screenshots(value: 'v1-screenshots'), + v1Messaging(value: 'v1-messaging'), + v1Migrations(value: 'v1-migrations'); - const Name({required this.value}); + const Name({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/o_auth_provider.dart b/lib/src/enums/o_auth_provider.dart index dc08c932..8ed7ecff 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,50 +1,55 @@ part of '../../enums.dart'; enum OAuthProvider { - amazon(value: 'amazon'), - apple(value: 'apple'), - auth0(value: 'auth0'), - authentik(value: 'authentik'), - autodesk(value: 'autodesk'), - bitbucket(value: 'bitbucket'), - bitly(value: 'bitly'), - box(value: 'box'), - dailymotion(value: 'dailymotion'), - discord(value: 'discord'), - disqus(value: 'disqus'), - dropbox(value: 'dropbox'), - etsy(value: 'etsy'), - facebook(value: 'facebook'), - figma(value: 'figma'), - github(value: 'github'), - gitlab(value: 'gitlab'), - google(value: 'google'), - linkedin(value: 'linkedin'), - microsoft(value: 'microsoft'), - notion(value: 'notion'), - oidc(value: 'oidc'), - okta(value: 'okta'), - paypal(value: 'paypal'), - paypalSandbox(value: 'paypalSandbox'), - podio(value: 'podio'), - salesforce(value: 'salesforce'), - slack(value: 'slack'), - spotify(value: 'spotify'), - stripe(value: 'stripe'), - tradeshift(value: 'tradeshift'), - tradeshiftBox(value: 'tradeshiftBox'), - twitch(value: 'twitch'), - wordpress(value: 'wordpress'), - x(value: 'x'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'); + amazon(value: 'amazon'), + apple(value: 'apple'), + auth0(value: 'auth0'), + authentik(value: 'authentik'), + autodesk(value: 'autodesk'), + bitbucket(value: 'bitbucket'), + bitly(value: 'bitly'), + box(value: 'box'), + dailymotion(value: 'dailymotion'), + discord(value: 'discord'), + disqus(value: 'disqus'), + dropbox(value: 'dropbox'), + etsy(value: 'etsy'), + facebook(value: 'facebook'), + figma(value: 'figma'), + fusionauth(value: 'fusionauth'), + github(value: 'github'), + gitlab(value: 'gitlab'), + google(value: 'google'), + keycloak(value: 'keycloak'), + kick(value: 'kick'), + linkedin(value: 'linkedin'), + microsoft(value: 'microsoft'), + notion(value: 'notion'), + oidc(value: 'oidc'), + okta(value: 'okta'), + paypal(value: 'paypal'), + paypalSandbox(value: 'paypalSandbox'), + podio(value: 'podio'), + salesforce(value: 'salesforce'), + slack(value: 'slack'), + spotify(value: 'spotify'), + stripe(value: 'stripe'), + tradeshift(value: 'tradeshift'), + tradeshiftBox(value: 'tradeshiftBox'), + twitch(value: 'twitch'), + wordpress(value: 'wordpress'), + x(value: 'x'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'); - const OAuthProvider({required this.value}); + const OAuthProvider({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/order_by.dart b/lib/src/enums/order_by.dart index c99546cc..661a419e 100644 --- a/lib/src/enums/order_by.dart +++ b/lib/src/enums/order_by.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum OrderBy { - asc(value: 'asc'), - desc(value: 'desc'); + asc(value: 'asc'), + desc(value: 'desc'); - const OrderBy({required this.value}); + const OrderBy({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/password_hash.dart b/lib/src/enums/password_hash.dart index 9d98c26a..510ee260 100644 --- a/lib/src/enums/password_hash.dart +++ b/lib/src/enums/password_hash.dart @@ -1,21 +1,23 @@ part of '../../enums.dart'; enum PasswordHash { - sha1(value: 'sha1'), - sha224(value: 'sha224'), - sha256(value: 'sha256'), - sha384(value: 'sha384'), - sha512224(value: 'sha512/224'), - sha512256(value: 'sha512/256'), - sha512(value: 'sha512'), - sha3224(value: 'sha3-224'), - sha3256(value: 'sha3-256'), - sha3384(value: 'sha3-384'), - sha3512(value: 'sha3-512'); + sha1(value: 'sha1'), + sha224(value: 'sha224'), + sha256(value: 'sha256'), + sha384(value: 'sha384'), + sha512224(value: 'sha512/224'), + sha512256(value: 'sha512/256'), + sha512(value: 'sha512'), + sha3224(value: 'sha3-224'), + sha3256(value: 'sha3-256'), + sha3384(value: 'sha3-384'), + sha3512(value: 'sha3-512'); - const PasswordHash({required this.value}); + const PasswordHash({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/platform_type.dart b/lib/src/enums/platform_type.dart index 8b3c8f08..216711d5 100644 --- a/lib/src/enums/platform_type.dart +++ b/lib/src/enums/platform_type.dart @@ -1,15 +1,17 @@ part of '../../enums.dart'; enum PlatformType { - windows(value: 'windows'), - apple(value: 'apple'), - android(value: 'android'), - linux(value: 'linux'), - web(value: 'web'); + windows(value: 'windows'), + apple(value: 'apple'), + android(value: 'android'), + linux(value: 'linux'), + web(value: 'web'); - const PlatformType({required this.value}); + const PlatformType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/policy_id.dart b/lib/src/enums/policy_id.dart new file mode 100644 index 00000000..2c48a989 --- /dev/null +++ b/lib/src/enums/policy_id.dart @@ -0,0 +1,21 @@ +part of '../../enums.dart'; + +enum PolicyId { + passwordDictionary(value: 'password-dictionary'), + passwordHistory(value: 'password-history'), + passwordPersonalData(value: 'password-personal-data'), + sessionAlert(value: 'session-alert'), + sessionDuration(value: 'session-duration'), + sessionInvalidation(value: 'session-invalidation'), + sessionLimit(value: 'session-limit'), + userLimit(value: 'user-limit'), + membershipPrivacy(value: 'membership-privacy'); + + const PolicyId({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/protocol_id.dart b/lib/src/enums/protocol_id.dart index a9dea8c9..b36c067c 100644 --- a/lib/src/enums/protocol_id.dart +++ b/lib/src/enums/protocol_id.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum ProtocolId { - rest(value: 'rest'), - graphql(value: 'graphql'), - websocket(value: 'websocket'); + rest(value: 'rest'), + graphql(value: 'graphql'), + websocket(value: 'websocket'); - const ProtocolId({required this.value}); + const ProtocolId({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/provider_id.dart b/lib/src/enums/provider_id.dart new file mode 100644 index 00000000..1aff211b --- /dev/null +++ b/lib/src/enums/provider_id.dart @@ -0,0 +1,59 @@ +part of '../../enums.dart'; + +enum ProviderId { + amazon(value: 'amazon'), + apple(value: 'apple'), + auth0(value: 'auth0'), + authentik(value: 'authentik'), + autodesk(value: 'autodesk'), + bitbucket(value: 'bitbucket'), + bitly(value: 'bitly'), + box(value: 'box'), + dailymotion(value: 'dailymotion'), + discord(value: 'discord'), + disqus(value: 'disqus'), + dropbox(value: 'dropbox'), + etsy(value: 'etsy'), + facebook(value: 'facebook'), + figma(value: 'figma'), + fusionauth(value: 'fusionauth'), + github(value: 'github'), + gitlab(value: 'gitlab'), + google(value: 'google'), + keycloak(value: 'keycloak'), + kick(value: 'kick'), + linkedin(value: 'linkedin'), + microsoft(value: 'microsoft'), + notion(value: 'notion'), + oidc(value: 'oidc'), + okta(value: 'okta'), + paypal(value: 'paypal'), + paypalSandbox(value: 'paypalSandbox'), + podio(value: 'podio'), + salesforce(value: 'salesforce'), + slack(value: 'slack'), + spotify(value: 'spotify'), + stripe(value: 'stripe'), + tradeshift(value: 'tradeshift'), + tradeshiftBox(value: 'tradeshiftBox'), + twitch(value: 'twitch'), + wordpress(value: 'wordpress'), + x(value: 'x'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'), + mockUnverified(value: 'mock-unverified'), + githubImagine(value: 'githubImagine'), + googleImagine(value: 'googleImagine'); + + const ProviderId({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/proxy_resource_type.dart b/lib/src/enums/proxy_resource_type.dart new file mode 100644 index 00000000..bce51db3 --- /dev/null +++ b/lib/src/enums/proxy_resource_type.dart @@ -0,0 +1,14 @@ +part of '../../enums.dart'; + +enum ProxyResourceType { + site(value: 'site'), + function(value: 'function'); + + const ProxyResourceType({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/proxy_rule_deployment_resource_type.dart b/lib/src/enums/proxy_rule_deployment_resource_type.dart new file mode 100644 index 00000000..963676d0 --- /dev/null +++ b/lib/src/enums/proxy_rule_deployment_resource_type.dart @@ -0,0 +1,14 @@ +part of '../../enums.dart'; + +enum ProxyRuleDeploymentResourceType { + function(value: 'function'), + site(value: 'site'); + + const ProxyRuleDeploymentResourceType({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/proxy_rule_status.dart b/lib/src/enums/proxy_rule_status.dart new file mode 100644 index 00000000..a13a2c65 --- /dev/null +++ b/lib/src/enums/proxy_rule_status.dart @@ -0,0 +1,15 @@ +part of '../../enums.dart'; + +enum ProxyRuleStatus { + unverified(value: 'unverified'), + verifying(value: 'verifying'), + verified(value: 'verified'); + + const ProxyRuleStatus({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/relation_mutate.dart b/lib/src/enums/relation_mutate.dart index b215a8fa..9f4c1a85 100644 --- a/lib/src/enums/relation_mutate.dart +++ b/lib/src/enums/relation_mutate.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum RelationMutate { - cascade(value: 'cascade'), - restrict(value: 'restrict'), - setNull(value: 'setNull'); + cascade(value: 'cascade'), + restrict(value: 'restrict'), + setNull(value: 'setNull'); - const RelationMutate({required this.value}); + const RelationMutate({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/relationship_type.dart b/lib/src/enums/relationship_type.dart index 30efc944..301bc61d 100644 --- a/lib/src/enums/relationship_type.dart +++ b/lib/src/enums/relationship_type.dart @@ -1,14 +1,16 @@ part of '../../enums.dart'; enum RelationshipType { - oneToOne(value: 'oneToOne'), - manyToOne(value: 'manyToOne'), - manyToMany(value: 'manyToMany'), - oneToMany(value: 'oneToMany'); + oneToOne(value: 'oneToOne'), + manyToOne(value: 'manyToOne'), + manyToMany(value: 'manyToMany'), + oneToMany(value: 'oneToMany'); - const RelationshipType({required this.value}); + const RelationshipType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/runtime.dart b/lib/src/enums/runtime.dart index 232aca0a..9afcc99f 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,98 +1,101 @@ part of '../../enums.dart'; enum Runtime { - node145(value: 'node-14.5'), - node160(value: 'node-16.0'), - node180(value: 'node-18.0'), - node190(value: 'node-19.0'), - node200(value: 'node-20.0'), - node210(value: 'node-21.0'), - node22(value: 'node-22'), - node23(value: 'node-23'), - node24(value: 'node-24'), - node25(value: 'node-25'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - php84(value: 'php-8.4'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - ruby34(value: 'ruby-3.4'), - ruby40(value: 'ruby-4.0'), - python38(value: 'python-3.8'), - python39(value: 'python-3.9'), - python310(value: 'python-3.10'), - python311(value: 'python-3.11'), - python312(value: 'python-3.12'), - python313(value: 'python-3.13'), - python314(value: 'python-3.14'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - pythonMl313(value: 'python-ml-3.13'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - deno25(value: 'deno-2.5'), - deno26(value: 'deno-2.6'), - dart215(value: 'dart-2.15'), - dart216(value: 'dart-2.16'), - dart217(value: 'dart-2.17'), - dart218(value: 'dart-2.18'), - dart219(value: 'dart-2.19'), - dart30(value: 'dart-3.0'), - dart31(value: 'dart-3.1'), - dart33(value: 'dart-3.3'), - dart35(value: 'dart-3.5'), - dart38(value: 'dart-3.8'), - dart39(value: 'dart-3.9'), - dart310(value: 'dart-3.10'), - dart311(value: 'dart-3.11'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - dotnet10(value: 'dotnet-10'), - java80(value: 'java-8.0'), - java110(value: 'java-11.0'), - java170(value: 'java-17.0'), - java180(value: 'java-18.0'), - java210(value: 'java-21.0'), - java22(value: 'java-22'), - java25(value: 'java-25'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - swift62(value: 'swift-6.2'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - kotlin23(value: 'kotlin-2.3'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - bun12(value: 'bun-1.2'), - bun13(value: 'bun-1.3'), - go123(value: 'go-1.23'), - go124(value: 'go-1.24'), - go125(value: 'go-1.25'), - go126(value: 'go-1.26'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'), - flutter335(value: 'flutter-3.35'), - flutter338(value: 'flutter-3.38'), - flutter341(value: 'flutter-3.41'); + node145(value: 'node-14.5'), + node160(value: 'node-16.0'), + node180(value: 'node-18.0'), + node190(value: 'node-19.0'), + node200(value: 'node-20.0'), + node210(value: 'node-21.0'), + node22(value: 'node-22'), + node23(value: 'node-23'), + node24(value: 'node-24'), + node25(value: 'node-25'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + php84(value: 'php-8.4'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + ruby34(value: 'ruby-3.4'), + ruby40(value: 'ruby-4.0'), + python38(value: 'python-3.8'), + python39(value: 'python-3.9'), + python310(value: 'python-3.10'), + python311(value: 'python-3.11'), + python312(value: 'python-3.12'), + python313(value: 'python-3.13'), + python314(value: 'python-3.14'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + pythonMl313(value: 'python-ml-3.13'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + deno25(value: 'deno-2.5'), + deno26(value: 'deno-2.6'), + dart215(value: 'dart-2.15'), + dart216(value: 'dart-2.16'), + dart217(value: 'dart-2.17'), + dart218(value: 'dart-2.18'), + dart219(value: 'dart-2.19'), + dart30(value: 'dart-3.0'), + dart31(value: 'dart-3.1'), + dart33(value: 'dart-3.3'), + dart35(value: 'dart-3.5'), + dart38(value: 'dart-3.8'), + dart39(value: 'dart-3.9'), + dart310(value: 'dart-3.10'), + dart311(value: 'dart-3.11'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + dotnet10(value: 'dotnet-10'), + java80(value: 'java-8.0'), + java110(value: 'java-11.0'), + java170(value: 'java-17.0'), + java180(value: 'java-18.0'), + java210(value: 'java-21.0'), + java22(value: 'java-22'), + java25(value: 'java-25'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + swift62(value: 'swift-6.2'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + kotlin23(value: 'kotlin-2.3'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + bun12(value: 'bun-1.2'), + bun13(value: 'bun-1.3'), + go123(value: 'go-1.23'), + go124(value: 'go-1.24'), + go125(value: 'go-1.25'), + go126(value: 'go-1.26'), + rust183(value: 'rust-1.83'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'), + flutter335(value: 'flutter-3.35'), + flutter338(value: 'flutter-3.38'), + flutter341(value: 'flutter-3.41'); - const Runtime({required this.value}); + const Runtime({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/scopes.dart b/lib/src/enums/scopes.dart index 64a925ec..7834dba9 100644 --- a/lib/src/enums/scopes.dart +++ b/lib/src/enums/scopes.dart @@ -1,84 +1,101 @@ part of '../../enums.dart'; enum Scopes { - sessionsWrite(value: 'sessions.write'), - usersRead(value: 'users.read'), - usersWrite(value: 'users.write'), - teamsRead(value: 'teams.read'), - teamsWrite(value: 'teams.write'), - databasesRead(value: 'databases.read'), - databasesWrite(value: 'databases.write'), - collectionsRead(value: 'collections.read'), - collectionsWrite(value: 'collections.write'), - tablesRead(value: 'tables.read'), - tablesWrite(value: 'tables.write'), - attributesRead(value: 'attributes.read'), - attributesWrite(value: 'attributes.write'), - columnsRead(value: 'columns.read'), - columnsWrite(value: 'columns.write'), - indexesRead(value: 'indexes.read'), - indexesWrite(value: 'indexes.write'), - documentsRead(value: 'documents.read'), - documentsWrite(value: 'documents.write'), - rowsRead(value: 'rows.read'), - rowsWrite(value: 'rows.write'), - filesRead(value: 'files.read'), - filesWrite(value: 'files.write'), - bucketsRead(value: 'buckets.read'), - bucketsWrite(value: 'buckets.write'), - functionsRead(value: 'functions.read'), - functionsWrite(value: 'functions.write'), - sitesRead(value: 'sites.read'), - sitesWrite(value: 'sites.write'), - logRead(value: 'log.read'), - logWrite(value: 'log.write'), - executionRead(value: 'execution.read'), - executionWrite(value: 'execution.write'), - localeRead(value: 'locale.read'), - avatarsRead(value: 'avatars.read'), - healthRead(value: 'health.read'), - providersRead(value: 'providers.read'), - providersWrite(value: 'providers.write'), - messagesRead(value: 'messages.read'), - messagesWrite(value: 'messages.write'), - topicsRead(value: 'topics.read'), - topicsWrite(value: 'topics.write'), - subscribersRead(value: 'subscribers.read'), - subscribersWrite(value: 'subscribers.write'), - targetsRead(value: 'targets.read'), - targetsWrite(value: 'targets.write'), - rulesRead(value: 'rules.read'), - rulesWrite(value: 'rules.write'), - schedulesRead(value: 'schedules.read'), - schedulesWrite(value: 'schedules.write'), - migrationsRead(value: 'migrations.read'), - migrationsWrite(value: 'migrations.write'), - vcsRead(value: 'vcs.read'), - vcsWrite(value: 'vcs.write'), - assistantRead(value: 'assistant.read'), - tokensRead(value: 'tokens.read'), - tokensWrite(value: 'tokens.write'), - webhooksRead(value: 'webhooks.read'), - webhooksWrite(value: 'webhooks.write'), - projectRead(value: 'project.read'), - projectWrite(value: 'project.write'), - keysRead(value: 'keys.read'), - keysWrite(value: 'keys.write'), - platformsRead(value: 'platforms.read'), - platformsWrite(value: 'platforms.write'), - policiesWrite(value: 'policies.write'), - policiesRead(value: 'policies.read'), - archivesRead(value: 'archives.read'), - archivesWrite(value: 'archives.write'), - restorationsRead(value: 'restorations.read'), - restorationsWrite(value: 'restorations.write'), - domainsRead(value: 'domains.read'), - domainsWrite(value: 'domains.write'), - eventsRead(value: 'events.read'); + projectRead(value: 'project.read'), + projectWrite(value: 'project.write'), + keysRead(value: 'keys.read'), + keysWrite(value: 'keys.write'), + platformsRead(value: 'platforms.read'), + platformsWrite(value: 'platforms.write'), + mocksRead(value: 'mocks.read'), + mocksWrite(value: 'mocks.write'), + policiesRead(value: 'policies.read'), + policiesWrite(value: 'policies.write'), + projectPoliciesRead(value: 'project.policies.read'), + projectPoliciesWrite(value: 'project.policies.write'), + templatesRead(value: 'templates.read'), + templatesWrite(value: 'templates.write'), + oauth2Read(value: 'oauth2.read'), + oauth2Write(value: 'oauth2.write'), + usersRead(value: 'users.read'), + usersWrite(value: 'users.write'), + sessionsRead(value: 'sessions.read'), + sessionsWrite(value: 'sessions.write'), + teamsRead(value: 'teams.read'), + teamsWrite(value: 'teams.write'), + databasesRead(value: 'databases.read'), + databasesWrite(value: 'databases.write'), + tablesRead(value: 'tables.read'), + tablesWrite(value: 'tables.write'), + columnsRead(value: 'columns.read'), + columnsWrite(value: 'columns.write'), + indexesRead(value: 'indexes.read'), + indexesWrite(value: 'indexes.write'), + rowsRead(value: 'rows.read'), + rowsWrite(value: 'rows.write'), + collectionsRead(value: 'collections.read'), + collectionsWrite(value: 'collections.write'), + attributesRead(value: 'attributes.read'), + attributesWrite(value: 'attributes.write'), + documentsRead(value: 'documents.read'), + documentsWrite(value: 'documents.write'), + bucketsRead(value: 'buckets.read'), + bucketsWrite(value: 'buckets.write'), + filesRead(value: 'files.read'), + filesWrite(value: 'files.write'), + tokensRead(value: 'tokens.read'), + tokensWrite(value: 'tokens.write'), + functionsRead(value: 'functions.read'), + functionsWrite(value: 'functions.write'), + executionsRead(value: 'executions.read'), + executionsWrite(value: 'executions.write'), + executionRead(value: 'execution.read'), + executionWrite(value: 'execution.write'), + sitesRead(value: 'sites.read'), + sitesWrite(value: 'sites.write'), + logRead(value: 'log.read'), + logWrite(value: 'log.write'), + providersRead(value: 'providers.read'), + providersWrite(value: 'providers.write'), + topicsRead(value: 'topics.read'), + topicsWrite(value: 'topics.write'), + subscribersRead(value: 'subscribers.read'), + subscribersWrite(value: 'subscribers.write'), + targetsRead(value: 'targets.read'), + targetsWrite(value: 'targets.write'), + messagesRead(value: 'messages.read'), + messagesWrite(value: 'messages.write'), + rulesRead(value: 'rules.read'), + rulesWrite(value: 'rules.write'), + webhooksRead(value: 'webhooks.read'), + webhooksWrite(value: 'webhooks.write'), + localeRead(value: 'locale.read'), + avatarsRead(value: 'avatars.read'), + healthRead(value: 'health.read'), + assistantRead(value: 'assistant.read'), + migrationsRead(value: 'migrations.read'), + migrationsWrite(value: 'migrations.write'), + schedulesRead(value: 'schedules.read'), + schedulesWrite(value: 'schedules.write'), + vcsRead(value: 'vcs.read'), + vcsWrite(value: 'vcs.write'), + presencesRead(value: 'presences.read'), + presencesWrite(value: 'presences.write'), + backupsPoliciesRead(value: 'backups.policies.read'), + backupsPoliciesWrite(value: 'backups.policies.write'), + archivesRead(value: 'archives.read'), + archivesWrite(value: 'archives.write'), + restorationsRead(value: 'restorations.read'), + restorationsWrite(value: 'restorations.write'), + domainsRead(value: 'domains.read'), + domainsWrite(value: 'domains.write'), + eventsRead(value: 'events.read'); - const Scopes({required this.value}); + const Scopes({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/secure.dart b/lib/src/enums/secure.dart new file mode 100644 index 00000000..754d242a --- /dev/null +++ b/lib/src/enums/secure.dart @@ -0,0 +1,14 @@ +part of '../../enums.dart'; + +enum Secure { + tls(value: 'tls'), + ssl(value: 'ssl'); + + const Secure({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/service_id.dart b/lib/src/enums/service_id.dart index 35c37fe8..8888a1ee 100644 --- a/lib/src/enums/service_id.dart +++ b/lib/src/enums/service_id.dart @@ -1,27 +1,29 @@ part of '../../enums.dart'; enum ServiceId { - account(value: 'account'), - avatars(value: 'avatars'), - databases(value: 'databases'), - tablesdb(value: 'tablesdb'), - locale(value: 'locale'), - health(value: 'health'), - project(value: 'project'), - storage(value: 'storage'), - teams(value: 'teams'), - users(value: 'users'), - vcs(value: 'vcs'), - sites(value: 'sites'), - functions(value: 'functions'), - proxy(value: 'proxy'), - graphql(value: 'graphql'), - migrations(value: 'migrations'), - messaging(value: 'messaging'); + account(value: 'account'), + avatars(value: 'avatars'), + databases(value: 'databases'), + tablesdb(value: 'tablesdb'), + locale(value: 'locale'), + health(value: 'health'), + project(value: 'project'), + storage(value: 'storage'), + teams(value: 'teams'), + users(value: 'users'), + vcs(value: 'vcs'), + sites(value: 'sites'), + functions(value: 'functions'), + proxy(value: 'proxy'), + graphql(value: 'graphql'), + migrations(value: 'migrations'), + messaging(value: 'messaging'); - const ServiceId({required this.value}); + const ServiceId({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/smtp_encryption.dart b/lib/src/enums/smtp_encryption.dart index cb6cee26..6c880ed6 100644 --- a/lib/src/enums/smtp_encryption.dart +++ b/lib/src/enums/smtp_encryption.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum SmtpEncryption { - none(value: 'none'), - ssl(value: 'ssl'), - tls(value: 'tls'); + none(value: 'none'), + ssl(value: 'ssl'), + tls(value: 'tls'); - const SmtpEncryption({required this.value}); + const SmtpEncryption({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/status_code.dart b/lib/src/enums/status_code.dart new file mode 100644 index 00000000..8273d8ee --- /dev/null +++ b/lib/src/enums/status_code.dart @@ -0,0 +1,16 @@ +part of '../../enums.dart'; + +enum StatusCode { + movedPermanently301(value: '301'), + found302(value: '302'), + temporaryRedirect307(value: '307'), + permanentRedirect308(value: '308'); + + const StatusCode({ + required this.value + }); + + final String value; + + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/tables_db_index_type.dart b/lib/src/enums/tables_db_index_type.dart index 77bec7a8..654ff3af 100644 --- a/lib/src/enums/tables_db_index_type.dart +++ b/lib/src/enums/tables_db_index_type.dart @@ -1,14 +1,16 @@ part of '../../enums.dart'; enum TablesDBIndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'), - spatial(value: 'spatial'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'), + spatial(value: 'spatial'); - const TablesDBIndexType({required this.value}); + const TablesDBIndexType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/template_reference_type.dart b/lib/src/enums/template_reference_type.dart index e688d654..3c0a2d90 100644 --- a/lib/src/enums/template_reference_type.dart +++ b/lib/src/enums/template_reference_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum TemplateReferenceType { - commit(value: 'commit'), - branch(value: 'branch'), - tag(value: 'tag'); + commit(value: 'commit'), + branch(value: 'branch'), + tag(value: 'tag'); - const TemplateReferenceType({required this.value}); + const TemplateReferenceType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/theme.dart b/lib/src/enums/theme.dart index 979320f1..1100e45f 100644 --- a/lib/src/enums/theme.dart +++ b/lib/src/enums/theme.dart @@ -1,12 +1,14 @@ part of '../../enums.dart'; enum Theme { - light(value: 'light'), - dark(value: 'dark'); + light(value: 'light'), + dark(value: 'dark'); - const Theme({required this.value}); + const Theme({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/timezone.dart b/lib/src/enums/timezone.dart index d5d8d94a..4a8de1ce 100644 --- a/lib/src/enums/timezone.dart +++ b/lib/src/enums/timezone.dart @@ -1,429 +1,431 @@ part of '../../enums.dart'; enum Timezone { - africaAbidjan(value: 'africa/abidjan'), - africaAccra(value: 'africa/accra'), - africaAddisAbaba(value: 'africa/addis_ababa'), - africaAlgiers(value: 'africa/algiers'), - africaAsmara(value: 'africa/asmara'), - africaBamako(value: 'africa/bamako'), - africaBangui(value: 'africa/bangui'), - africaBanjul(value: 'africa/banjul'), - africaBissau(value: 'africa/bissau'), - africaBlantyre(value: 'africa/blantyre'), - africaBrazzaville(value: 'africa/brazzaville'), - africaBujumbura(value: 'africa/bujumbura'), - africaCairo(value: 'africa/cairo'), - africaCasablanca(value: 'africa/casablanca'), - africaCeuta(value: 'africa/ceuta'), - africaConakry(value: 'africa/conakry'), - africaDakar(value: 'africa/dakar'), - africaDarEsSalaam(value: 'africa/dar_es_salaam'), - africaDjibouti(value: 'africa/djibouti'), - africaDouala(value: 'africa/douala'), - africaElAaiun(value: 'africa/el_aaiun'), - africaFreetown(value: 'africa/freetown'), - africaGaborone(value: 'africa/gaborone'), - africaHarare(value: 'africa/harare'), - africaJohannesburg(value: 'africa/johannesburg'), - africaJuba(value: 'africa/juba'), - africaKampala(value: 'africa/kampala'), - africaKhartoum(value: 'africa/khartoum'), - africaKigali(value: 'africa/kigali'), - africaKinshasa(value: 'africa/kinshasa'), - africaLagos(value: 'africa/lagos'), - africaLibreville(value: 'africa/libreville'), - africaLome(value: 'africa/lome'), - africaLuanda(value: 'africa/luanda'), - africaLubumbashi(value: 'africa/lubumbashi'), - africaLusaka(value: 'africa/lusaka'), - africaMalabo(value: 'africa/malabo'), - africaMaputo(value: 'africa/maputo'), - africaMaseru(value: 'africa/maseru'), - africaMbabane(value: 'africa/mbabane'), - africaMogadishu(value: 'africa/mogadishu'), - africaMonrovia(value: 'africa/monrovia'), - africaNairobi(value: 'africa/nairobi'), - africaNdjamena(value: 'africa/ndjamena'), - africaNiamey(value: 'africa/niamey'), - africaNouakchott(value: 'africa/nouakchott'), - africaOuagadougou(value: 'africa/ouagadougou'), - africaPortoNovo(value: 'africa/porto-novo'), - africaSaoTome(value: 'africa/sao_tome'), - africaTripoli(value: 'africa/tripoli'), - africaTunis(value: 'africa/tunis'), - africaWindhoek(value: 'africa/windhoek'), - americaAdak(value: 'america/adak'), - americaAnchorage(value: 'america/anchorage'), - americaAnguilla(value: 'america/anguilla'), - americaAntigua(value: 'america/antigua'), - americaAraguaina(value: 'america/araguaina'), - americaArgentinaBuenosAires(value: 'america/argentina/buenos_aires'), - americaArgentinaCatamarca(value: 'america/argentina/catamarca'), - americaArgentinaCordoba(value: 'america/argentina/cordoba'), - americaArgentinaJujuy(value: 'america/argentina/jujuy'), - americaArgentinaLaRioja(value: 'america/argentina/la_rioja'), - americaArgentinaMendoza(value: 'america/argentina/mendoza'), - americaArgentinaRioGallegos(value: 'america/argentina/rio_gallegos'), - americaArgentinaSalta(value: 'america/argentina/salta'), - americaArgentinaSanJuan(value: 'america/argentina/san_juan'), - americaArgentinaSanLuis(value: 'america/argentina/san_luis'), - americaArgentinaTucuman(value: 'america/argentina/tucuman'), - americaArgentinaUshuaia(value: 'america/argentina/ushuaia'), - americaAruba(value: 'america/aruba'), - americaAsuncion(value: 'america/asuncion'), - americaAtikokan(value: 'america/atikokan'), - americaBahia(value: 'america/bahia'), - americaBahiaBanderas(value: 'america/bahia_banderas'), - americaBarbados(value: 'america/barbados'), - americaBelem(value: 'america/belem'), - americaBelize(value: 'america/belize'), - americaBlancSablon(value: 'america/blanc-sablon'), - americaBoaVista(value: 'america/boa_vista'), - americaBogota(value: 'america/bogota'), - americaBoise(value: 'america/boise'), - americaCambridgeBay(value: 'america/cambridge_bay'), - americaCampoGrande(value: 'america/campo_grande'), - americaCancun(value: 'america/cancun'), - americaCaracas(value: 'america/caracas'), - americaCayenne(value: 'america/cayenne'), - americaCayman(value: 'america/cayman'), - americaChicago(value: 'america/chicago'), - americaChihuahua(value: 'america/chihuahua'), - americaCiudadJuarez(value: 'america/ciudad_juarez'), - americaCostaRica(value: 'america/costa_rica'), - americaCoyhaique(value: 'america/coyhaique'), - americaCreston(value: 'america/creston'), - americaCuiaba(value: 'america/cuiaba'), - americaCuracao(value: 'america/curacao'), - americaDanmarkshavn(value: 'america/danmarkshavn'), - americaDawson(value: 'america/dawson'), - americaDawsonCreek(value: 'america/dawson_creek'), - americaDenver(value: 'america/denver'), - americaDetroit(value: 'america/detroit'), - americaDominica(value: 'america/dominica'), - americaEdmonton(value: 'america/edmonton'), - americaEirunepe(value: 'america/eirunepe'), - americaElSalvador(value: 'america/el_salvador'), - americaFortNelson(value: 'america/fort_nelson'), - americaFortaleza(value: 'america/fortaleza'), - americaGlaceBay(value: 'america/glace_bay'), - americaGooseBay(value: 'america/goose_bay'), - americaGrandTurk(value: 'america/grand_turk'), - americaGrenada(value: 'america/grenada'), - americaGuadeloupe(value: 'america/guadeloupe'), - americaGuatemala(value: 'america/guatemala'), - americaGuayaquil(value: 'america/guayaquil'), - americaGuyana(value: 'america/guyana'), - americaHalifax(value: 'america/halifax'), - americaHavana(value: 'america/havana'), - americaHermosillo(value: 'america/hermosillo'), - americaIndianaIndianapolis(value: 'america/indiana/indianapolis'), - americaIndianaKnox(value: 'america/indiana/knox'), - americaIndianaMarengo(value: 'america/indiana/marengo'), - americaIndianaPetersburg(value: 'america/indiana/petersburg'), - americaIndianaTellCity(value: 'america/indiana/tell_city'), - americaIndianaVevay(value: 'america/indiana/vevay'), - americaIndianaVincennes(value: 'america/indiana/vincennes'), - americaIndianaWinamac(value: 'america/indiana/winamac'), - americaInuvik(value: 'america/inuvik'), - americaIqaluit(value: 'america/iqaluit'), - americaJamaica(value: 'america/jamaica'), - americaJuneau(value: 'america/juneau'), - americaKentuckyLouisville(value: 'america/kentucky/louisville'), - americaKentuckyMonticello(value: 'america/kentucky/monticello'), - americaKralendijk(value: 'america/kralendijk'), - americaLaPaz(value: 'america/la_paz'), - americaLima(value: 'america/lima'), - americaLosAngeles(value: 'america/los_angeles'), - americaLowerPrinces(value: 'america/lower_princes'), - americaMaceio(value: 'america/maceio'), - americaManagua(value: 'america/managua'), - americaManaus(value: 'america/manaus'), - americaMarigot(value: 'america/marigot'), - americaMartinique(value: 'america/martinique'), - americaMatamoros(value: 'america/matamoros'), - americaMazatlan(value: 'america/mazatlan'), - americaMenominee(value: 'america/menominee'), - americaMerida(value: 'america/merida'), - americaMetlakatla(value: 'america/metlakatla'), - americaMexicoCity(value: 'america/mexico_city'), - americaMiquelon(value: 'america/miquelon'), - americaMoncton(value: 'america/moncton'), - americaMonterrey(value: 'america/monterrey'), - americaMontevideo(value: 'america/montevideo'), - americaMontserrat(value: 'america/montserrat'), - americaNassau(value: 'america/nassau'), - americaNewYork(value: 'america/new_york'), - americaNome(value: 'america/nome'), - americaNoronha(value: 'america/noronha'), - americaNorthDakotaBeulah(value: 'america/north_dakota/beulah'), - americaNorthDakotaCenter(value: 'america/north_dakota/center'), - americaNorthDakotaNewSalem(value: 'america/north_dakota/new_salem'), - americaNuuk(value: 'america/nuuk'), - americaOjinaga(value: 'america/ojinaga'), - americaPanama(value: 'america/panama'), - americaParamaribo(value: 'america/paramaribo'), - americaPhoenix(value: 'america/phoenix'), - americaPortAuPrince(value: 'america/port-au-prince'), - americaPortOfSpain(value: 'america/port_of_spain'), - americaPortoVelho(value: 'america/porto_velho'), - americaPuertoRico(value: 'america/puerto_rico'), - americaPuntaArenas(value: 'america/punta_arenas'), - americaRankinInlet(value: 'america/rankin_inlet'), - americaRecife(value: 'america/recife'), - americaRegina(value: 'america/regina'), - americaResolute(value: 'america/resolute'), - americaRioBranco(value: 'america/rio_branco'), - americaSantarem(value: 'america/santarem'), - americaSantiago(value: 'america/santiago'), - americaSantoDomingo(value: 'america/santo_domingo'), - americaSaoPaulo(value: 'america/sao_paulo'), - americaScoresbysund(value: 'america/scoresbysund'), - americaSitka(value: 'america/sitka'), - americaStBarthelemy(value: 'america/st_barthelemy'), - americaStJohns(value: 'america/st_johns'), - americaStKitts(value: 'america/st_kitts'), - americaStLucia(value: 'america/st_lucia'), - americaStThomas(value: 'america/st_thomas'), - americaStVincent(value: 'america/st_vincent'), - americaSwiftCurrent(value: 'america/swift_current'), - americaTegucigalpa(value: 'america/tegucigalpa'), - americaThule(value: 'america/thule'), - americaTijuana(value: 'america/tijuana'), - americaToronto(value: 'america/toronto'), - americaTortola(value: 'america/tortola'), - americaVancouver(value: 'america/vancouver'), - americaWhitehorse(value: 'america/whitehorse'), - americaWinnipeg(value: 'america/winnipeg'), - americaYakutat(value: 'america/yakutat'), - antarcticaCasey(value: 'antarctica/casey'), - antarcticaDavis(value: 'antarctica/davis'), - antarcticaDumontdurville(value: 'antarctica/dumontdurville'), - antarcticaMacquarie(value: 'antarctica/macquarie'), - antarcticaMawson(value: 'antarctica/mawson'), - antarcticaMcmurdo(value: 'antarctica/mcmurdo'), - antarcticaPalmer(value: 'antarctica/palmer'), - antarcticaRothera(value: 'antarctica/rothera'), - antarcticaSyowa(value: 'antarctica/syowa'), - antarcticaTroll(value: 'antarctica/troll'), - antarcticaVostok(value: 'antarctica/vostok'), - arcticLongyearbyen(value: 'arctic/longyearbyen'), - asiaAden(value: 'asia/aden'), - asiaAlmaty(value: 'asia/almaty'), - asiaAmman(value: 'asia/amman'), - asiaAnadyr(value: 'asia/anadyr'), - asiaAqtau(value: 'asia/aqtau'), - asiaAqtobe(value: 'asia/aqtobe'), - asiaAshgabat(value: 'asia/ashgabat'), - asiaAtyrau(value: 'asia/atyrau'), - asiaBaghdad(value: 'asia/baghdad'), - asiaBahrain(value: 'asia/bahrain'), - asiaBaku(value: 'asia/baku'), - asiaBangkok(value: 'asia/bangkok'), - asiaBarnaul(value: 'asia/barnaul'), - asiaBeirut(value: 'asia/beirut'), - asiaBishkek(value: 'asia/bishkek'), - asiaBrunei(value: 'asia/brunei'), - asiaChita(value: 'asia/chita'), - asiaColombo(value: 'asia/colombo'), - asiaDamascus(value: 'asia/damascus'), - asiaDhaka(value: 'asia/dhaka'), - asiaDili(value: 'asia/dili'), - asiaDubai(value: 'asia/dubai'), - asiaDushanbe(value: 'asia/dushanbe'), - asiaFamagusta(value: 'asia/famagusta'), - asiaGaza(value: 'asia/gaza'), - asiaHebron(value: 'asia/hebron'), - asiaHoChiMinh(value: 'asia/ho_chi_minh'), - asiaHongKong(value: 'asia/hong_kong'), - asiaHovd(value: 'asia/hovd'), - asiaIrkutsk(value: 'asia/irkutsk'), - asiaJakarta(value: 'asia/jakarta'), - asiaJayapura(value: 'asia/jayapura'), - asiaJerusalem(value: 'asia/jerusalem'), - asiaKabul(value: 'asia/kabul'), - asiaKamchatka(value: 'asia/kamchatka'), - asiaKarachi(value: 'asia/karachi'), - asiaKathmandu(value: 'asia/kathmandu'), - asiaKhandyga(value: 'asia/khandyga'), - asiaKolkata(value: 'asia/kolkata'), - asiaKrasnoyarsk(value: 'asia/krasnoyarsk'), - asiaKualaLumpur(value: 'asia/kuala_lumpur'), - asiaKuching(value: 'asia/kuching'), - asiaKuwait(value: 'asia/kuwait'), - asiaMacau(value: 'asia/macau'), - asiaMagadan(value: 'asia/magadan'), - asiaMakassar(value: 'asia/makassar'), - asiaManila(value: 'asia/manila'), - asiaMuscat(value: 'asia/muscat'), - asiaNicosia(value: 'asia/nicosia'), - asiaNovokuznetsk(value: 'asia/novokuznetsk'), - asiaNovosibirsk(value: 'asia/novosibirsk'), - asiaOmsk(value: 'asia/omsk'), - asiaOral(value: 'asia/oral'), - asiaPhnomPenh(value: 'asia/phnom_penh'), - asiaPontianak(value: 'asia/pontianak'), - asiaPyongyang(value: 'asia/pyongyang'), - asiaQatar(value: 'asia/qatar'), - asiaQostanay(value: 'asia/qostanay'), - asiaQyzylorda(value: 'asia/qyzylorda'), - asiaRiyadh(value: 'asia/riyadh'), - asiaSakhalin(value: 'asia/sakhalin'), - asiaSamarkand(value: 'asia/samarkand'), - asiaSeoul(value: 'asia/seoul'), - asiaShanghai(value: 'asia/shanghai'), - asiaSingapore(value: 'asia/singapore'), - asiaSrednekolymsk(value: 'asia/srednekolymsk'), - asiaTaipei(value: 'asia/taipei'), - asiaTashkent(value: 'asia/tashkent'), - asiaTbilisi(value: 'asia/tbilisi'), - asiaTehran(value: 'asia/tehran'), - asiaThimphu(value: 'asia/thimphu'), - asiaTokyo(value: 'asia/tokyo'), - asiaTomsk(value: 'asia/tomsk'), - asiaUlaanbaatar(value: 'asia/ulaanbaatar'), - asiaUrumqi(value: 'asia/urumqi'), - asiaUstNera(value: 'asia/ust-nera'), - asiaVientiane(value: 'asia/vientiane'), - asiaVladivostok(value: 'asia/vladivostok'), - asiaYakutsk(value: 'asia/yakutsk'), - asiaYangon(value: 'asia/yangon'), - asiaYekaterinburg(value: 'asia/yekaterinburg'), - asiaYerevan(value: 'asia/yerevan'), - atlanticAzores(value: 'atlantic/azores'), - atlanticBermuda(value: 'atlantic/bermuda'), - atlanticCanary(value: 'atlantic/canary'), - atlanticCapeVerde(value: 'atlantic/cape_verde'), - atlanticFaroe(value: 'atlantic/faroe'), - atlanticMadeira(value: 'atlantic/madeira'), - atlanticReykjavik(value: 'atlantic/reykjavik'), - atlanticSouthGeorgia(value: 'atlantic/south_georgia'), - atlanticStHelena(value: 'atlantic/st_helena'), - atlanticStanley(value: 'atlantic/stanley'), - australiaAdelaide(value: 'australia/adelaide'), - australiaBrisbane(value: 'australia/brisbane'), - australiaBrokenHill(value: 'australia/broken_hill'), - australiaDarwin(value: 'australia/darwin'), - australiaEucla(value: 'australia/eucla'), - australiaHobart(value: 'australia/hobart'), - australiaLindeman(value: 'australia/lindeman'), - australiaLordHowe(value: 'australia/lord_howe'), - australiaMelbourne(value: 'australia/melbourne'), - australiaPerth(value: 'australia/perth'), - australiaSydney(value: 'australia/sydney'), - europeAmsterdam(value: 'europe/amsterdam'), - europeAndorra(value: 'europe/andorra'), - europeAstrakhan(value: 'europe/astrakhan'), - europeAthens(value: 'europe/athens'), - europeBelgrade(value: 'europe/belgrade'), - europeBerlin(value: 'europe/berlin'), - europeBratislava(value: 'europe/bratislava'), - europeBrussels(value: 'europe/brussels'), - europeBucharest(value: 'europe/bucharest'), - europeBudapest(value: 'europe/budapest'), - europeBusingen(value: 'europe/busingen'), - europeChisinau(value: 'europe/chisinau'), - europeCopenhagen(value: 'europe/copenhagen'), - europeDublin(value: 'europe/dublin'), - europeGibraltar(value: 'europe/gibraltar'), - europeGuernsey(value: 'europe/guernsey'), - europeHelsinki(value: 'europe/helsinki'), - europeIsleOfMan(value: 'europe/isle_of_man'), - europeIstanbul(value: 'europe/istanbul'), - europeJersey(value: 'europe/jersey'), - europeKaliningrad(value: 'europe/kaliningrad'), - europeKirov(value: 'europe/kirov'), - europeKyiv(value: 'europe/kyiv'), - europeLisbon(value: 'europe/lisbon'), - europeLjubljana(value: 'europe/ljubljana'), - europeLondon(value: 'europe/london'), - europeLuxembourg(value: 'europe/luxembourg'), - europeMadrid(value: 'europe/madrid'), - europeMalta(value: 'europe/malta'), - europeMariehamn(value: 'europe/mariehamn'), - europeMinsk(value: 'europe/minsk'), - europeMonaco(value: 'europe/monaco'), - europeMoscow(value: 'europe/moscow'), - europeOslo(value: 'europe/oslo'), - europeParis(value: 'europe/paris'), - europePodgorica(value: 'europe/podgorica'), - europePrague(value: 'europe/prague'), - europeRiga(value: 'europe/riga'), - europeRome(value: 'europe/rome'), - europeSamara(value: 'europe/samara'), - europeSanMarino(value: 'europe/san_marino'), - europeSarajevo(value: 'europe/sarajevo'), - europeSaratov(value: 'europe/saratov'), - europeSimferopol(value: 'europe/simferopol'), - europeSkopje(value: 'europe/skopje'), - europeSofia(value: 'europe/sofia'), - europeStockholm(value: 'europe/stockholm'), - europeTallinn(value: 'europe/tallinn'), - europeTirane(value: 'europe/tirane'), - europeUlyanovsk(value: 'europe/ulyanovsk'), - europeVaduz(value: 'europe/vaduz'), - europeVatican(value: 'europe/vatican'), - europeVienna(value: 'europe/vienna'), - europeVilnius(value: 'europe/vilnius'), - europeVolgograd(value: 'europe/volgograd'), - europeWarsaw(value: 'europe/warsaw'), - europeZagreb(value: 'europe/zagreb'), - europeZurich(value: 'europe/zurich'), - indianAntananarivo(value: 'indian/antananarivo'), - indianChagos(value: 'indian/chagos'), - indianChristmas(value: 'indian/christmas'), - indianCocos(value: 'indian/cocos'), - indianComoro(value: 'indian/comoro'), - indianKerguelen(value: 'indian/kerguelen'), - indianMahe(value: 'indian/mahe'), - indianMaldives(value: 'indian/maldives'), - indianMauritius(value: 'indian/mauritius'), - indianMayotte(value: 'indian/mayotte'), - indianReunion(value: 'indian/reunion'), - pacificApia(value: 'pacific/apia'), - pacificAuckland(value: 'pacific/auckland'), - pacificBougainville(value: 'pacific/bougainville'), - pacificChatham(value: 'pacific/chatham'), - pacificChuuk(value: 'pacific/chuuk'), - pacificEaster(value: 'pacific/easter'), - pacificEfate(value: 'pacific/efate'), - pacificFakaofo(value: 'pacific/fakaofo'), - pacificFiji(value: 'pacific/fiji'), - pacificFunafuti(value: 'pacific/funafuti'), - pacificGalapagos(value: 'pacific/galapagos'), - pacificGambier(value: 'pacific/gambier'), - pacificGuadalcanal(value: 'pacific/guadalcanal'), - pacificGuam(value: 'pacific/guam'), - pacificHonolulu(value: 'pacific/honolulu'), - pacificKanton(value: 'pacific/kanton'), - pacificKiritimati(value: 'pacific/kiritimati'), - pacificKosrae(value: 'pacific/kosrae'), - pacificKwajalein(value: 'pacific/kwajalein'), - pacificMajuro(value: 'pacific/majuro'), - pacificMarquesas(value: 'pacific/marquesas'), - pacificMidway(value: 'pacific/midway'), - pacificNauru(value: 'pacific/nauru'), - pacificNiue(value: 'pacific/niue'), - pacificNorfolk(value: 'pacific/norfolk'), - pacificNoumea(value: 'pacific/noumea'), - pacificPagoPago(value: 'pacific/pago_pago'), - pacificPalau(value: 'pacific/palau'), - pacificPitcairn(value: 'pacific/pitcairn'), - pacificPohnpei(value: 'pacific/pohnpei'), - pacificPortMoresby(value: 'pacific/port_moresby'), - pacificRarotonga(value: 'pacific/rarotonga'), - pacificSaipan(value: 'pacific/saipan'), - pacificTahiti(value: 'pacific/tahiti'), - pacificTarawa(value: 'pacific/tarawa'), - pacificTongatapu(value: 'pacific/tongatapu'), - pacificWake(value: 'pacific/wake'), - pacificWallis(value: 'pacific/wallis'), - utc(value: 'utc'); + africaAbidjan(value: 'africa/abidjan'), + africaAccra(value: 'africa/accra'), + africaAddisAbaba(value: 'africa/addis_ababa'), + africaAlgiers(value: 'africa/algiers'), + africaAsmara(value: 'africa/asmara'), + africaBamako(value: 'africa/bamako'), + africaBangui(value: 'africa/bangui'), + africaBanjul(value: 'africa/banjul'), + africaBissau(value: 'africa/bissau'), + africaBlantyre(value: 'africa/blantyre'), + africaBrazzaville(value: 'africa/brazzaville'), + africaBujumbura(value: 'africa/bujumbura'), + africaCairo(value: 'africa/cairo'), + africaCasablanca(value: 'africa/casablanca'), + africaCeuta(value: 'africa/ceuta'), + africaConakry(value: 'africa/conakry'), + africaDakar(value: 'africa/dakar'), + africaDarEsSalaam(value: 'africa/dar_es_salaam'), + africaDjibouti(value: 'africa/djibouti'), + africaDouala(value: 'africa/douala'), + africaElAaiun(value: 'africa/el_aaiun'), + africaFreetown(value: 'africa/freetown'), + africaGaborone(value: 'africa/gaborone'), + africaHarare(value: 'africa/harare'), + africaJohannesburg(value: 'africa/johannesburg'), + africaJuba(value: 'africa/juba'), + africaKampala(value: 'africa/kampala'), + africaKhartoum(value: 'africa/khartoum'), + africaKigali(value: 'africa/kigali'), + africaKinshasa(value: 'africa/kinshasa'), + africaLagos(value: 'africa/lagos'), + africaLibreville(value: 'africa/libreville'), + africaLome(value: 'africa/lome'), + africaLuanda(value: 'africa/luanda'), + africaLubumbashi(value: 'africa/lubumbashi'), + africaLusaka(value: 'africa/lusaka'), + africaMalabo(value: 'africa/malabo'), + africaMaputo(value: 'africa/maputo'), + africaMaseru(value: 'africa/maseru'), + africaMbabane(value: 'africa/mbabane'), + africaMogadishu(value: 'africa/mogadishu'), + africaMonrovia(value: 'africa/monrovia'), + africaNairobi(value: 'africa/nairobi'), + africaNdjamena(value: 'africa/ndjamena'), + africaNiamey(value: 'africa/niamey'), + africaNouakchott(value: 'africa/nouakchott'), + africaOuagadougou(value: 'africa/ouagadougou'), + africaPortoNovo(value: 'africa/porto-novo'), + africaSaoTome(value: 'africa/sao_tome'), + africaTripoli(value: 'africa/tripoli'), + africaTunis(value: 'africa/tunis'), + africaWindhoek(value: 'africa/windhoek'), + americaAdak(value: 'america/adak'), + americaAnchorage(value: 'america/anchorage'), + americaAnguilla(value: 'america/anguilla'), + americaAntigua(value: 'america/antigua'), + americaAraguaina(value: 'america/araguaina'), + americaArgentinaBuenosAires(value: 'america/argentina/buenos_aires'), + americaArgentinaCatamarca(value: 'america/argentina/catamarca'), + americaArgentinaCordoba(value: 'america/argentina/cordoba'), + americaArgentinaJujuy(value: 'america/argentina/jujuy'), + americaArgentinaLaRioja(value: 'america/argentina/la_rioja'), + americaArgentinaMendoza(value: 'america/argentina/mendoza'), + americaArgentinaRioGallegos(value: 'america/argentina/rio_gallegos'), + americaArgentinaSalta(value: 'america/argentina/salta'), + americaArgentinaSanJuan(value: 'america/argentina/san_juan'), + americaArgentinaSanLuis(value: 'america/argentina/san_luis'), + americaArgentinaTucuman(value: 'america/argentina/tucuman'), + americaArgentinaUshuaia(value: 'america/argentina/ushuaia'), + americaAruba(value: 'america/aruba'), + americaAsuncion(value: 'america/asuncion'), + americaAtikokan(value: 'america/atikokan'), + americaBahia(value: 'america/bahia'), + americaBahiaBanderas(value: 'america/bahia_banderas'), + americaBarbados(value: 'america/barbados'), + americaBelem(value: 'america/belem'), + americaBelize(value: 'america/belize'), + americaBlancSablon(value: 'america/blanc-sablon'), + americaBoaVista(value: 'america/boa_vista'), + americaBogota(value: 'america/bogota'), + americaBoise(value: 'america/boise'), + americaCambridgeBay(value: 'america/cambridge_bay'), + americaCampoGrande(value: 'america/campo_grande'), + americaCancun(value: 'america/cancun'), + americaCaracas(value: 'america/caracas'), + americaCayenne(value: 'america/cayenne'), + americaCayman(value: 'america/cayman'), + americaChicago(value: 'america/chicago'), + americaChihuahua(value: 'america/chihuahua'), + americaCiudadJuarez(value: 'america/ciudad_juarez'), + americaCostaRica(value: 'america/costa_rica'), + americaCoyhaique(value: 'america/coyhaique'), + americaCreston(value: 'america/creston'), + americaCuiaba(value: 'america/cuiaba'), + americaCuracao(value: 'america/curacao'), + americaDanmarkshavn(value: 'america/danmarkshavn'), + americaDawson(value: 'america/dawson'), + americaDawsonCreek(value: 'america/dawson_creek'), + americaDenver(value: 'america/denver'), + americaDetroit(value: 'america/detroit'), + americaDominica(value: 'america/dominica'), + americaEdmonton(value: 'america/edmonton'), + americaEirunepe(value: 'america/eirunepe'), + americaElSalvador(value: 'america/el_salvador'), + americaFortNelson(value: 'america/fort_nelson'), + americaFortaleza(value: 'america/fortaleza'), + americaGlaceBay(value: 'america/glace_bay'), + americaGooseBay(value: 'america/goose_bay'), + americaGrandTurk(value: 'america/grand_turk'), + americaGrenada(value: 'america/grenada'), + americaGuadeloupe(value: 'america/guadeloupe'), + americaGuatemala(value: 'america/guatemala'), + americaGuayaquil(value: 'america/guayaquil'), + americaGuyana(value: 'america/guyana'), + americaHalifax(value: 'america/halifax'), + americaHavana(value: 'america/havana'), + americaHermosillo(value: 'america/hermosillo'), + americaIndianaIndianapolis(value: 'america/indiana/indianapolis'), + americaIndianaKnox(value: 'america/indiana/knox'), + americaIndianaMarengo(value: 'america/indiana/marengo'), + americaIndianaPetersburg(value: 'america/indiana/petersburg'), + americaIndianaTellCity(value: 'america/indiana/tell_city'), + americaIndianaVevay(value: 'america/indiana/vevay'), + americaIndianaVincennes(value: 'america/indiana/vincennes'), + americaIndianaWinamac(value: 'america/indiana/winamac'), + americaInuvik(value: 'america/inuvik'), + americaIqaluit(value: 'america/iqaluit'), + americaJamaica(value: 'america/jamaica'), + americaJuneau(value: 'america/juneau'), + americaKentuckyLouisville(value: 'america/kentucky/louisville'), + americaKentuckyMonticello(value: 'america/kentucky/monticello'), + americaKralendijk(value: 'america/kralendijk'), + americaLaPaz(value: 'america/la_paz'), + americaLima(value: 'america/lima'), + americaLosAngeles(value: 'america/los_angeles'), + americaLowerPrinces(value: 'america/lower_princes'), + americaMaceio(value: 'america/maceio'), + americaManagua(value: 'america/managua'), + americaManaus(value: 'america/manaus'), + americaMarigot(value: 'america/marigot'), + americaMartinique(value: 'america/martinique'), + americaMatamoros(value: 'america/matamoros'), + americaMazatlan(value: 'america/mazatlan'), + americaMenominee(value: 'america/menominee'), + americaMerida(value: 'america/merida'), + americaMetlakatla(value: 'america/metlakatla'), + americaMexicoCity(value: 'america/mexico_city'), + americaMiquelon(value: 'america/miquelon'), + americaMoncton(value: 'america/moncton'), + americaMonterrey(value: 'america/monterrey'), + americaMontevideo(value: 'america/montevideo'), + americaMontserrat(value: 'america/montserrat'), + americaNassau(value: 'america/nassau'), + americaNewYork(value: 'america/new_york'), + americaNome(value: 'america/nome'), + americaNoronha(value: 'america/noronha'), + americaNorthDakotaBeulah(value: 'america/north_dakota/beulah'), + americaNorthDakotaCenter(value: 'america/north_dakota/center'), + americaNorthDakotaNewSalem(value: 'america/north_dakota/new_salem'), + americaNuuk(value: 'america/nuuk'), + americaOjinaga(value: 'america/ojinaga'), + americaPanama(value: 'america/panama'), + americaParamaribo(value: 'america/paramaribo'), + americaPhoenix(value: 'america/phoenix'), + americaPortAuPrince(value: 'america/port-au-prince'), + americaPortOfSpain(value: 'america/port_of_spain'), + americaPortoVelho(value: 'america/porto_velho'), + americaPuertoRico(value: 'america/puerto_rico'), + americaPuntaArenas(value: 'america/punta_arenas'), + americaRankinInlet(value: 'america/rankin_inlet'), + americaRecife(value: 'america/recife'), + americaRegina(value: 'america/regina'), + americaResolute(value: 'america/resolute'), + americaRioBranco(value: 'america/rio_branco'), + americaSantarem(value: 'america/santarem'), + americaSantiago(value: 'america/santiago'), + americaSantoDomingo(value: 'america/santo_domingo'), + americaSaoPaulo(value: 'america/sao_paulo'), + americaScoresbysund(value: 'america/scoresbysund'), + americaSitka(value: 'america/sitka'), + americaStBarthelemy(value: 'america/st_barthelemy'), + americaStJohns(value: 'america/st_johns'), + americaStKitts(value: 'america/st_kitts'), + americaStLucia(value: 'america/st_lucia'), + americaStThomas(value: 'america/st_thomas'), + americaStVincent(value: 'america/st_vincent'), + americaSwiftCurrent(value: 'america/swift_current'), + americaTegucigalpa(value: 'america/tegucigalpa'), + americaThule(value: 'america/thule'), + americaTijuana(value: 'america/tijuana'), + americaToronto(value: 'america/toronto'), + americaTortola(value: 'america/tortola'), + americaVancouver(value: 'america/vancouver'), + americaWhitehorse(value: 'america/whitehorse'), + americaWinnipeg(value: 'america/winnipeg'), + americaYakutat(value: 'america/yakutat'), + antarcticaCasey(value: 'antarctica/casey'), + antarcticaDavis(value: 'antarctica/davis'), + antarcticaDumontdurville(value: 'antarctica/dumontdurville'), + antarcticaMacquarie(value: 'antarctica/macquarie'), + antarcticaMawson(value: 'antarctica/mawson'), + antarcticaMcmurdo(value: 'antarctica/mcmurdo'), + antarcticaPalmer(value: 'antarctica/palmer'), + antarcticaRothera(value: 'antarctica/rothera'), + antarcticaSyowa(value: 'antarctica/syowa'), + antarcticaTroll(value: 'antarctica/troll'), + antarcticaVostok(value: 'antarctica/vostok'), + arcticLongyearbyen(value: 'arctic/longyearbyen'), + asiaAden(value: 'asia/aden'), + asiaAlmaty(value: 'asia/almaty'), + asiaAmman(value: 'asia/amman'), + asiaAnadyr(value: 'asia/anadyr'), + asiaAqtau(value: 'asia/aqtau'), + asiaAqtobe(value: 'asia/aqtobe'), + asiaAshgabat(value: 'asia/ashgabat'), + asiaAtyrau(value: 'asia/atyrau'), + asiaBaghdad(value: 'asia/baghdad'), + asiaBahrain(value: 'asia/bahrain'), + asiaBaku(value: 'asia/baku'), + asiaBangkok(value: 'asia/bangkok'), + asiaBarnaul(value: 'asia/barnaul'), + asiaBeirut(value: 'asia/beirut'), + asiaBishkek(value: 'asia/bishkek'), + asiaBrunei(value: 'asia/brunei'), + asiaChita(value: 'asia/chita'), + asiaColombo(value: 'asia/colombo'), + asiaDamascus(value: 'asia/damascus'), + asiaDhaka(value: 'asia/dhaka'), + asiaDili(value: 'asia/dili'), + asiaDubai(value: 'asia/dubai'), + asiaDushanbe(value: 'asia/dushanbe'), + asiaFamagusta(value: 'asia/famagusta'), + asiaGaza(value: 'asia/gaza'), + asiaHebron(value: 'asia/hebron'), + asiaHoChiMinh(value: 'asia/ho_chi_minh'), + asiaHongKong(value: 'asia/hong_kong'), + asiaHovd(value: 'asia/hovd'), + asiaIrkutsk(value: 'asia/irkutsk'), + asiaJakarta(value: 'asia/jakarta'), + asiaJayapura(value: 'asia/jayapura'), + asiaJerusalem(value: 'asia/jerusalem'), + asiaKabul(value: 'asia/kabul'), + asiaKamchatka(value: 'asia/kamchatka'), + asiaKarachi(value: 'asia/karachi'), + asiaKathmandu(value: 'asia/kathmandu'), + asiaKhandyga(value: 'asia/khandyga'), + asiaKolkata(value: 'asia/kolkata'), + asiaKrasnoyarsk(value: 'asia/krasnoyarsk'), + asiaKualaLumpur(value: 'asia/kuala_lumpur'), + asiaKuching(value: 'asia/kuching'), + asiaKuwait(value: 'asia/kuwait'), + asiaMacau(value: 'asia/macau'), + asiaMagadan(value: 'asia/magadan'), + asiaMakassar(value: 'asia/makassar'), + asiaManila(value: 'asia/manila'), + asiaMuscat(value: 'asia/muscat'), + asiaNicosia(value: 'asia/nicosia'), + asiaNovokuznetsk(value: 'asia/novokuznetsk'), + asiaNovosibirsk(value: 'asia/novosibirsk'), + asiaOmsk(value: 'asia/omsk'), + asiaOral(value: 'asia/oral'), + asiaPhnomPenh(value: 'asia/phnom_penh'), + asiaPontianak(value: 'asia/pontianak'), + asiaPyongyang(value: 'asia/pyongyang'), + asiaQatar(value: 'asia/qatar'), + asiaQostanay(value: 'asia/qostanay'), + asiaQyzylorda(value: 'asia/qyzylorda'), + asiaRiyadh(value: 'asia/riyadh'), + asiaSakhalin(value: 'asia/sakhalin'), + asiaSamarkand(value: 'asia/samarkand'), + asiaSeoul(value: 'asia/seoul'), + asiaShanghai(value: 'asia/shanghai'), + asiaSingapore(value: 'asia/singapore'), + asiaSrednekolymsk(value: 'asia/srednekolymsk'), + asiaTaipei(value: 'asia/taipei'), + asiaTashkent(value: 'asia/tashkent'), + asiaTbilisi(value: 'asia/tbilisi'), + asiaTehran(value: 'asia/tehran'), + asiaThimphu(value: 'asia/thimphu'), + asiaTokyo(value: 'asia/tokyo'), + asiaTomsk(value: 'asia/tomsk'), + asiaUlaanbaatar(value: 'asia/ulaanbaatar'), + asiaUrumqi(value: 'asia/urumqi'), + asiaUstNera(value: 'asia/ust-nera'), + asiaVientiane(value: 'asia/vientiane'), + asiaVladivostok(value: 'asia/vladivostok'), + asiaYakutsk(value: 'asia/yakutsk'), + asiaYangon(value: 'asia/yangon'), + asiaYekaterinburg(value: 'asia/yekaterinburg'), + asiaYerevan(value: 'asia/yerevan'), + atlanticAzores(value: 'atlantic/azores'), + atlanticBermuda(value: 'atlantic/bermuda'), + atlanticCanary(value: 'atlantic/canary'), + atlanticCapeVerde(value: 'atlantic/cape_verde'), + atlanticFaroe(value: 'atlantic/faroe'), + atlanticMadeira(value: 'atlantic/madeira'), + atlanticReykjavik(value: 'atlantic/reykjavik'), + atlanticSouthGeorgia(value: 'atlantic/south_georgia'), + atlanticStHelena(value: 'atlantic/st_helena'), + atlanticStanley(value: 'atlantic/stanley'), + australiaAdelaide(value: 'australia/adelaide'), + australiaBrisbane(value: 'australia/brisbane'), + australiaBrokenHill(value: 'australia/broken_hill'), + australiaDarwin(value: 'australia/darwin'), + australiaEucla(value: 'australia/eucla'), + australiaHobart(value: 'australia/hobart'), + australiaLindeman(value: 'australia/lindeman'), + australiaLordHowe(value: 'australia/lord_howe'), + australiaMelbourne(value: 'australia/melbourne'), + australiaPerth(value: 'australia/perth'), + australiaSydney(value: 'australia/sydney'), + europeAmsterdam(value: 'europe/amsterdam'), + europeAndorra(value: 'europe/andorra'), + europeAstrakhan(value: 'europe/astrakhan'), + europeAthens(value: 'europe/athens'), + europeBelgrade(value: 'europe/belgrade'), + europeBerlin(value: 'europe/berlin'), + europeBratislava(value: 'europe/bratislava'), + europeBrussels(value: 'europe/brussels'), + europeBucharest(value: 'europe/bucharest'), + europeBudapest(value: 'europe/budapest'), + europeBusingen(value: 'europe/busingen'), + europeChisinau(value: 'europe/chisinau'), + europeCopenhagen(value: 'europe/copenhagen'), + europeDublin(value: 'europe/dublin'), + europeGibraltar(value: 'europe/gibraltar'), + europeGuernsey(value: 'europe/guernsey'), + europeHelsinki(value: 'europe/helsinki'), + europeIsleOfMan(value: 'europe/isle_of_man'), + europeIstanbul(value: 'europe/istanbul'), + europeJersey(value: 'europe/jersey'), + europeKaliningrad(value: 'europe/kaliningrad'), + europeKirov(value: 'europe/kirov'), + europeKyiv(value: 'europe/kyiv'), + europeLisbon(value: 'europe/lisbon'), + europeLjubljana(value: 'europe/ljubljana'), + europeLondon(value: 'europe/london'), + europeLuxembourg(value: 'europe/luxembourg'), + europeMadrid(value: 'europe/madrid'), + europeMalta(value: 'europe/malta'), + europeMariehamn(value: 'europe/mariehamn'), + europeMinsk(value: 'europe/minsk'), + europeMonaco(value: 'europe/monaco'), + europeMoscow(value: 'europe/moscow'), + europeOslo(value: 'europe/oslo'), + europeParis(value: 'europe/paris'), + europePodgorica(value: 'europe/podgorica'), + europePrague(value: 'europe/prague'), + europeRiga(value: 'europe/riga'), + europeRome(value: 'europe/rome'), + europeSamara(value: 'europe/samara'), + europeSanMarino(value: 'europe/san_marino'), + europeSarajevo(value: 'europe/sarajevo'), + europeSaratov(value: 'europe/saratov'), + europeSimferopol(value: 'europe/simferopol'), + europeSkopje(value: 'europe/skopje'), + europeSofia(value: 'europe/sofia'), + europeStockholm(value: 'europe/stockholm'), + europeTallinn(value: 'europe/tallinn'), + europeTirane(value: 'europe/tirane'), + europeUlyanovsk(value: 'europe/ulyanovsk'), + europeVaduz(value: 'europe/vaduz'), + europeVatican(value: 'europe/vatican'), + europeVienna(value: 'europe/vienna'), + europeVilnius(value: 'europe/vilnius'), + europeVolgograd(value: 'europe/volgograd'), + europeWarsaw(value: 'europe/warsaw'), + europeZagreb(value: 'europe/zagreb'), + europeZurich(value: 'europe/zurich'), + indianAntananarivo(value: 'indian/antananarivo'), + indianChagos(value: 'indian/chagos'), + indianChristmas(value: 'indian/christmas'), + indianCocos(value: 'indian/cocos'), + indianComoro(value: 'indian/comoro'), + indianKerguelen(value: 'indian/kerguelen'), + indianMahe(value: 'indian/mahe'), + indianMaldives(value: 'indian/maldives'), + indianMauritius(value: 'indian/mauritius'), + indianMayotte(value: 'indian/mayotte'), + indianReunion(value: 'indian/reunion'), + pacificApia(value: 'pacific/apia'), + pacificAuckland(value: 'pacific/auckland'), + pacificBougainville(value: 'pacific/bougainville'), + pacificChatham(value: 'pacific/chatham'), + pacificChuuk(value: 'pacific/chuuk'), + pacificEaster(value: 'pacific/easter'), + pacificEfate(value: 'pacific/efate'), + pacificFakaofo(value: 'pacific/fakaofo'), + pacificFiji(value: 'pacific/fiji'), + pacificFunafuti(value: 'pacific/funafuti'), + pacificGalapagos(value: 'pacific/galapagos'), + pacificGambier(value: 'pacific/gambier'), + pacificGuadalcanal(value: 'pacific/guadalcanal'), + pacificGuam(value: 'pacific/guam'), + pacificHonolulu(value: 'pacific/honolulu'), + pacificKanton(value: 'pacific/kanton'), + pacificKiritimati(value: 'pacific/kiritimati'), + pacificKosrae(value: 'pacific/kosrae'), + pacificKwajalein(value: 'pacific/kwajalein'), + pacificMajuro(value: 'pacific/majuro'), + pacificMarquesas(value: 'pacific/marquesas'), + pacificMidway(value: 'pacific/midway'), + pacificNauru(value: 'pacific/nauru'), + pacificNiue(value: 'pacific/niue'), + pacificNorfolk(value: 'pacific/norfolk'), + pacificNoumea(value: 'pacific/noumea'), + pacificPagoPago(value: 'pacific/pago_pago'), + pacificPalau(value: 'pacific/palau'), + pacificPitcairn(value: 'pacific/pitcairn'), + pacificPohnpei(value: 'pacific/pohnpei'), + pacificPortMoresby(value: 'pacific/port_moresby'), + pacificRarotonga(value: 'pacific/rarotonga'), + pacificSaipan(value: 'pacific/saipan'), + pacificTahiti(value: 'pacific/tahiti'), + pacificTarawa(value: 'pacific/tarawa'), + pacificTongatapu(value: 'pacific/tongatapu'), + pacificWake(value: 'pacific/wake'), + pacificWallis(value: 'pacific/wallis'), + utc(value: 'utc'); - const Timezone({required this.value}); + const Timezone({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/enums/vcs_reference_type.dart b/lib/src/enums/vcs_reference_type.dart index c7e72f1c..ae726469 100644 --- a/lib/src/enums/vcs_reference_type.dart +++ b/lib/src/enums/vcs_reference_type.dart @@ -1,13 +1,15 @@ part of '../../enums.dart'; enum VCSReferenceType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSReferenceType({required this.value}); + const VCSReferenceType({ + required this.value + }); - final String value; + final String value; - String toJson() => value; -} + String toJson() => value; +} \ No newline at end of file diff --git a/lib/src/exception.dart b/lib/src/exception.dart index 82229daa..93b6ee3d 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -13,7 +13,7 @@ class AppwriteException implements Exception { /// Initializes an Appwrite Exception. AppwriteException([this.message = "", this.code, this.type, this.response]); - + /// Returns the error type, message, and code. @override String toString() { diff --git a/lib/src/models/activity_event.dart b/lib/src/models/activity_event.dart index 107f492c..aba4fd22 100644 --- a/lib/src/models/activity_event.dart +++ b/lib/src/models/activity_event.dart @@ -2,209 +2,209 @@ part of '../../models.dart'; /// ActivityEvent class ActivityEvent implements Model { - /// Event ID. - final String $id; + /// Event ID. + final String $id; - /// User type. - final String userType; + /// User type. + final String userType; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// User Email. - final String userEmail; + /// User Email. + final String userEmail; - /// User Name. - final String userName; + /// User Name. + final String userName; - /// Resource parent. - final String resourceParent; + /// Resource parent. + final String resourceParent; - /// Resource type. - final String resourceType; + /// Resource type. + final String resourceType; - /// Resource ID. - final String resourceId; + /// Resource ID. + final String resourceId; - /// Resource. - final String resource; + /// Resource. + final String resource; - /// Event name. - final String event; + /// Event name. + final String event; - /// User agent. - final String userAgent; + /// User agent. + final String userAgent; - /// IP address. - final String ip; - - /// API mode when event triggered. - final String mode; - - /// Location. - final String country; - - /// Log creation date in ISO 8601 format. - final String time; - - /// Project ID. - final String projectId; - - /// Team ID. - final String teamId; - - /// Hostname. - final String hostname; - - /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - final String osCode; - - /// Operating system name. - final String osName; - - /// Operating system version. - final String osVersion; - - /// Client type. - final String clientType; - - /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - final String clientCode; - - /// Client name. - final String clientName; - - /// Client version. - final String clientVersion; - - /// Client engine name. - final String clientEngine; - - /// Client engine name. - final String clientEngineVersion; - - /// Device name. - final String deviceName; - - /// Device brand name. - final String deviceBrand; - - /// Device model name. - final String deviceModel; - - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; - - /// Country name. - final String countryName; - - ActivityEvent({ - required this.$id, - required this.userType, - required this.userId, - required this.userEmail, - required this.userName, - required this.resourceParent, - required this.resourceType, - required this.resourceId, - required this.resource, - required this.event, - required this.userAgent, - required this.ip, - required this.mode, - required this.country, - required this.time, - required this.projectId, - required this.teamId, - required this.hostname, - required this.osCode, - required this.osName, - required this.osVersion, - required this.clientType, - required this.clientCode, - required this.clientName, - required this.clientVersion, - required this.clientEngine, - required this.clientEngineVersion, - required this.deviceName, - required this.deviceBrand, - required this.deviceModel, - required this.countryCode, - required this.countryName, - }); - - factory ActivityEvent.fromMap(Map map) { - return ActivityEvent( - $id: map['\$id'].toString(), - userType: map['userType'].toString(), - userId: map['userId'].toString(), - userEmail: map['userEmail'].toString(), - userName: map['userName'].toString(), - resourceParent: map['resourceParent'].toString(), - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - resource: map['resource'].toString(), - event: map['event'].toString(), - userAgent: map['userAgent'].toString(), - ip: map['ip'].toString(), - mode: map['mode'].toString(), - country: map['country'].toString(), - time: map['time'].toString(), - projectId: map['projectId'].toString(), - teamId: map['teamId'].toString(), - hostname: map['hostname'].toString(), - osCode: map['osCode'].toString(), - osName: map['osName'].toString(), - osVersion: map['osVersion'].toString(), - clientType: map['clientType'].toString(), - clientCode: map['clientCode'].toString(), - clientName: map['clientName'].toString(), - clientVersion: map['clientVersion'].toString(), - clientEngine: map['clientEngine'].toString(), - clientEngineVersion: map['clientEngineVersion'].toString(), - deviceName: map['deviceName'].toString(), - deviceBrand: map['deviceBrand'].toString(), - deviceModel: map['deviceModel'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "userType": userType, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "resourceParent": resourceParent, - "resourceType": resourceType, - "resourceId": resourceId, - "resource": resource, - "event": event, - "userAgent": userAgent, - "ip": ip, - "mode": mode, - "country": country, - "time": time, - "projectId": projectId, - "teamId": teamId, - "hostname": hostname, - "osCode": osCode, - "osName": osName, - "osVersion": osVersion, - "clientType": clientType, - "clientCode": clientCode, - "clientName": clientName, - "clientVersion": clientVersion, - "clientEngine": clientEngine, - "clientEngineVersion": clientEngineVersion, - "deviceName": deviceName, - "deviceBrand": deviceBrand, - "deviceModel": deviceModel, - "countryCode": countryCode, - "countryName": countryName, - }; - } + /// IP address. + final String ip; + + /// API mode when event triggered. + final String mode; + + /// Location. + final String country; + + /// Log creation date in ISO 8601 format. + final String time; + + /// Project ID. + final String projectId; + + /// Team ID. + final String teamId; + + /// Hostname. + final String hostname; + + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + final String osCode; + + /// Operating system name. + final String osName; + + /// Operating system version. + final String osVersion; + + /// Client type. + final String clientType; + + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + final String clientCode; + + /// Client name. + final String clientName; + + /// Client version. + final String clientVersion; + + /// Client engine name. + final String clientEngine; + + /// Client engine name. + final String clientEngineVersion; + + /// Device name. + final String deviceName; + + /// Device brand name. + final String deviceBrand; + + /// Device model name. + final String deviceModel; + + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; + + /// Country name. + final String countryName; + + ActivityEvent({ + required this.$id, + required this.userType, + required this.userId, + required this.userEmail, + required this.userName, + required this.resourceParent, + required this.resourceType, + required this.resourceId, + required this.resource, + required this.event, + required this.userAgent, + required this.ip, + required this.mode, + required this.country, + required this.time, + required this.projectId, + required this.teamId, + required this.hostname, + required this.osCode, + required this.osName, + required this.osVersion, + required this.clientType, + required this.clientCode, + required this.clientName, + required this.clientVersion, + required this.clientEngine, + required this.clientEngineVersion, + required this.deviceName, + required this.deviceBrand, + required this.deviceModel, + required this.countryCode, + required this.countryName, + }); + + factory ActivityEvent.fromMap(Map map) { + return ActivityEvent( + $id: map['\$id'].toString(), + userType: map['userType'].toString(), + userId: map['userId'].toString(), + userEmail: map['userEmail'].toString(), + userName: map['userName'].toString(), + resourceParent: map['resourceParent'].toString(), + resourceType: map['resourceType'].toString(), + resourceId: map['resourceId'].toString(), + resource: map['resource'].toString(), + event: map['event'].toString(), + userAgent: map['userAgent'].toString(), + ip: map['ip'].toString(), + mode: map['mode'].toString(), + country: map['country'].toString(), + time: map['time'].toString(), + projectId: map['projectId'].toString(), + teamId: map['teamId'].toString(), + hostname: map['hostname'].toString(), + osCode: map['osCode'].toString(), + osName: map['osName'].toString(), + osVersion: map['osVersion'].toString(), + clientType: map['clientType'].toString(), + clientCode: map['clientCode'].toString(), + clientName: map['clientName'].toString(), + clientVersion: map['clientVersion'].toString(), + clientEngine: map['clientEngine'].toString(), + clientEngineVersion: map['clientEngineVersion'].toString(), + deviceName: map['deviceName'].toString(), + deviceBrand: map['deviceBrand'].toString(), + deviceModel: map['deviceModel'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "userType": userType, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "resourceParent": resourceParent, + "resourceType": resourceType, + "resourceId": resourceId, + "resource": resource, + "event": event, + "userAgent": userAgent, + "ip": ip, + "mode": mode, + "country": country, + "time": time, + "projectId": projectId, + "teamId": teamId, + "hostname": hostname, + "osCode": osCode, + "osName": osName, + "osVersion": osVersion, + "clientType": clientType, + "clientCode": clientCode, + "clientName": clientName, + "clientVersion": clientVersion, + "clientEngine": clientEngine, + "clientEngineVersion": clientEngineVersion, + "deviceName": deviceName, + "deviceBrand": deviceBrand, + "deviceModel": deviceModel, + "countryCode": countryCode, + "countryName": countryName, + }; + } } diff --git a/lib/src/models/activity_event_list.dart b/lib/src/models/activity_event_list.dart index 1825f531..d7637024 100644 --- a/lib/src/models/activity_event_list.dart +++ b/lib/src/models/activity_event_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Activity event list class ActivityEventList implements Model { - /// Total number of events that matched your query. - final int total; + /// Total number of events that matched your query. + final int total; - /// List of events. - final List events; + /// List of events. + final List events; - ActivityEventList({ - required this.total, - required this.events, - }); + ActivityEventList({ + required this.total, + required this.events, + }); - factory ActivityEventList.fromMap(Map map) { - return ActivityEventList( - total: map['total'], - events: List.from( - map['events'].map((p) => ActivityEvent.fromMap(p))), - ); - } + factory ActivityEventList.fromMap(Map map) { + return ActivityEventList( + total: map['total'], + events: List.from(map['events'].map((p) => ActivityEvent.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "events": events.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "events": events.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/algo_argon2.dart b/lib/src/models/algo_argon2.dart index 344a8770..f80fa854 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// AlgoArgon2 class AlgoArgon2 implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - /// Memory used to compute hash. - final int memoryCost; + /// Memory used to compute hash. + final int memoryCost; - /// Amount of time consumed to compute hash - final int timeCost; + /// Amount of time consumed to compute hash + final int timeCost; - /// Number of threads used to compute hash. - final int threads; + /// Number of threads used to compute hash. + final int threads; - AlgoArgon2({ - required this.type, - required this.memoryCost, - required this.timeCost, - required this.threads, - }); + AlgoArgon2({ + required this.type, + required this.memoryCost, + required this.timeCost, + required this.threads, + }); - factory AlgoArgon2.fromMap(Map map) { - return AlgoArgon2( - type: map['type'].toString(), - memoryCost: map['memoryCost'], - timeCost: map['timeCost'], - threads: map['threads'], - ); - } + factory AlgoArgon2.fromMap(Map map) { + return AlgoArgon2( + type: map['type'].toString(), + memoryCost: map['memoryCost'], + timeCost: map['timeCost'], + threads: map['threads'], + ); + } - @override - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + @override + Map toMap() { + return { + "type": type, + "memoryCost": memoryCost, + "timeCost": timeCost, + "threads": threads, + }; + } } diff --git a/lib/src/models/algo_bcrypt.dart b/lib/src/models/algo_bcrypt.dart index 9909265e..c51da4bb 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoBcrypt class AlgoBcrypt implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoBcrypt({ - required this.type, - }); + AlgoBcrypt({ + required this.type, + }); - factory AlgoBcrypt.fromMap(Map map) { - return AlgoBcrypt( - type: map['type'].toString(), - ); - } + factory AlgoBcrypt.fromMap(Map map) { + return AlgoBcrypt( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 746fbd52..43523ab1 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoMD5 class AlgoMd5 implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoMd5({ - required this.type, - }); + AlgoMd5({ + required this.type, + }); - factory AlgoMd5.fromMap(Map map) { - return AlgoMd5( - type: map['type'].toString(), - ); - } + factory AlgoMd5.fromMap(Map map) { + return AlgoMd5( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index cab45e49..8562c4e3 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoPHPass class AlgoPhpass implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoPhpass({ - required this.type, - }); + AlgoPhpass({ + required this.type, + }); - factory AlgoPhpass.fromMap(Map map) { - return AlgoPhpass( - type: map['type'].toString(), - ); - } + factory AlgoPhpass.fromMap(Map map) { + return AlgoPhpass( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index a1648843..8e844839 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// AlgoScrypt class AlgoScrypt implements Model { - /// Algo type. - final String type; - - /// CPU complexity of computed hash. - final int costCpu; - - /// Memory complexity of computed hash. - final int costMemory; - - /// Parallelization of computed hash. - final int costParallel; - - /// Length used to compute hash. - final int length; - - AlgoScrypt({ - required this.type, - required this.costCpu, - required this.costMemory, - required this.costParallel, - required this.length, - }); - - factory AlgoScrypt.fromMap(Map map) { - return AlgoScrypt( - type: map['type'].toString(), - costCpu: map['costCpu'], - costMemory: map['costMemory'], - costParallel: map['costParallel'], - length: map['length'], - ); - } - - @override - Map toMap() { - return { - "type": type, - "costCpu": costCpu, - "costMemory": costMemory, - "costParallel": costParallel, - "length": length, - }; - } + /// Algo type. + final String type; + + /// CPU complexity of computed hash. + final int costCpu; + + /// Memory complexity of computed hash. + final int costMemory; + + /// Parallelization of computed hash. + final int costParallel; + + /// Length used to compute hash. + final int length; + + AlgoScrypt({ + required this.type, + required this.costCpu, + required this.costMemory, + required this.costParallel, + required this.length, + }); + + factory AlgoScrypt.fromMap(Map map) { + return AlgoScrypt( + type: map['type'].toString(), + costCpu: map['costCpu'], + costMemory: map['costMemory'], + costParallel: map['costParallel'], + length: map['length'], + ); + } + + @override + Map toMap() { + return { + "type": type, + "costCpu": costCpu, + "costMemory": costMemory, + "costParallel": costParallel, + "length": length, + }; + } } diff --git a/lib/src/models/algo_scrypt_modified.dart b/lib/src/models/algo_scrypt_modified.dart index 33ef4a6f..5202db05 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// AlgoScryptModified class AlgoScryptModified implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - /// Salt used to compute hash. - final String salt; + /// Salt used to compute hash. + final String salt; - /// Separator used to compute hash. - final String saltSeparator; + /// Separator used to compute hash. + final String saltSeparator; - /// Key used to compute hash. - final String signerKey; + /// Key used to compute hash. + final String signerKey; - AlgoScryptModified({ - required this.type, - required this.salt, - required this.saltSeparator, - required this.signerKey, - }); + AlgoScryptModified({ + required this.type, + required this.salt, + required this.saltSeparator, + required this.signerKey, + }); - factory AlgoScryptModified.fromMap(Map map) { - return AlgoScryptModified( - type: map['type'].toString(), - salt: map['salt'].toString(), - saltSeparator: map['saltSeparator'].toString(), - signerKey: map['signerKey'].toString(), - ); - } + factory AlgoScryptModified.fromMap(Map map) { + return AlgoScryptModified( + type: map['type'].toString(), + salt: map['salt'].toString(), + saltSeparator: map['saltSeparator'].toString(), + signerKey: map['signerKey'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + @override + Map toMap() { + return { + "type": type, + "salt": salt, + "saltSeparator": saltSeparator, + "signerKey": signerKey, + }; + } } diff --git a/lib/src/models/algo_sha.dart b/lib/src/models/algo_sha.dart index 4984df75..3d08af9f 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoSHA class AlgoSha implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoSha({ - required this.type, - }); + AlgoSha({ + required this.type, + }); - factory AlgoSha.fromMap(Map map) { - return AlgoSha( - type: map['type'].toString(), - ); - } + factory AlgoSha.fromMap(Map map) { + return AlgoSha( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_bigint.dart b/lib/src/models/attribute_bigint.dart new file mode 100644 index 00000000..ad6d8825 --- /dev/null +++ b/lib/src/models/attribute_bigint.dart @@ -0,0 +1,84 @@ +part of '../../models.dart'; + +/// AttributeBigInt +class AttributeBigint implements Model { + /// Attribute Key. + final String key; + + /// Attribute type. + final String type; + + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; + + /// Is attribute required? + final bool xrequired; + + /// Is attribute an array? + final bool? array; + + /// Attribute creation date in ISO 8601 format. + final String $createdAt; + + /// Attribute update date in ISO 8601 format. + final String $updatedAt; + + /// Minimum value to enforce for new documents. + final int? min; + + /// Maximum value to enforce for new documents. + final int? max; + + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final int? xdefault; + + AttributeBigint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); + + factory AttributeBigint.fromMap(Map map) { + return AttributeBigint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } +} diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 1c250548..3a682ae3 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// AttributeBoolean class AttributeBoolean implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final bool? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final bool? xdefault; - AttributeBoolean({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributeBoolean({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributeBoolean.fromMap(Map map) { - return AttributeBoolean( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default'], - ); - } + factory AttributeBoolean.fromMap(Map map) { + return AttributeBoolean( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_datetime.dart b/lib/src/models/attribute_datetime.dart index 2c0a5d09..59828b4f 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeDatetime class AttributeDatetime implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// ISO 8601 format. - final String format; + /// ISO 8601 format. + final String format; - /// Default value for attribute when not provided. Only null is optional - final String? xdefault; + /// Default value for attribute when not provided. Only null is optional + final String? xdefault; - AttributeDatetime({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeDatetime({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeDatetime.fromMap(Map map) { - return AttributeDatetime( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeDatetime.fromMap(Map map) { + return AttributeDatetime( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_email.dart b/lib/src/models/attribute_email.dart index f6f54b51..0a78bc62 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeEmail class AttributeEmail implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeEmail({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeEmail({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeEmail.fromMap(Map map) { - return AttributeEmail( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeEmail.fromMap(Map map) { + return AttributeEmail( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_enum.dart b/lib/src/models/attribute_enum.dart index 078e1b5a..dd947620 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// AttributeEnum class AttributeEnum implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Array of elements in enumerated type. - final List elements; + /// Array of elements in enumerated type. + final List elements; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeEnum({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.elements, - required this.format, - this.xdefault, - }); + AttributeEnum({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.elements, + required this.format, + this.xdefault, + }); - factory AttributeEnum.fromMap(Map map) { - return AttributeEnum( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - elements: List.from(map['elements'] ?? []), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeEnum.fromMap(Map map) { + return AttributeEnum( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + elements: List.from(map['elements'] ?? []), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "elements": elements, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_float.dart b/lib/src/models/attribute_float.dart index 09d14fb8..c964e467 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// AttributeFloat class AttributeFloat implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final double? min; + /// Minimum value to enforce for new documents. + final double? min; - /// Maximum value to enforce for new documents. - final double? max; + /// Maximum value to enforce for new documents. + final double? max; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final double? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final double? xdefault; - AttributeFloat({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + AttributeFloat({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory AttributeFloat.fromMap(Map map) { - return AttributeFloat( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min']?.toDouble(), - max: map['max']?.toDouble(), - xdefault: map['default']?.toDouble(), - ); - } + factory AttributeFloat.fromMap(Map map) { + return AttributeFloat( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min']?.toDouble(), + max: map['max']?.toDouble(), + xdefault: map['default']?.toDouble(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_integer.dart b/lib/src/models/attribute_integer.dart index 215b0495..5a0e23fd 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// AttributeInteger class AttributeInteger implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final int? min; + /// Minimum value to enforce for new documents. + final int? min; - /// Maximum value to enforce for new documents. - final int? max; + /// Maximum value to enforce for new documents. + final int? max; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final int? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final int? xdefault; - AttributeInteger({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + AttributeInteger({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory AttributeInteger.fromMap(Map map) { - return AttributeInteger( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min'], - max: map['max'], - xdefault: map['default'], - ); - } + factory AttributeInteger.fromMap(Map map) { + return AttributeInteger( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_ip.dart b/lib/src/models/attribute_ip.dart index 0382fd57..d6e0e53c 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeIP class AttributeIp implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeIp({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeIp({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeIp.fromMap(Map map) { - return AttributeIp( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeIp.fromMap(Map map) { + return AttributeIp( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_line.dart b/lib/src/models/attribute_line.dart index 5a8ffefc..67f07950 100644 --- a/lib/src/models/attribute_line.dart +++ b/lib/src/models/attribute_line.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// AttributeLine class AttributeLine implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final List? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final List? xdefault; - AttributeLine({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributeLine({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributeLine.fromMap(Map map) { - return AttributeLine( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory AttributeLine.fromMap(Map map) { + return AttributeLine( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index 3b6e3acb..add46b52 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Attributes List class AttributeList implements Model { - /// Total number of attributes in the given collection. - final int total; + /// Total number of attributes in the given collection. + final int total; - /// List of attributes. - final List attributes; + /// List of attributes. + final List attributes; - AttributeList({ - required this.total, - required this.attributes, - }); + AttributeList({ + required this.total, + required this.attributes, + }); - factory AttributeList.fromMap(Map map) { - return AttributeList( - total: map['total'], - attributes: List.from(map['attributes'] ?? []), - ); - } + factory AttributeList.fromMap(Map map) { + return AttributeList( + total: map['total'], + attributes: List.from(map['attributes'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + @override + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_longtext.dart b/lib/src/models/attribute_longtext.dart index 31a77052..6b98f59b 100644 --- a/lib/src/models/attribute_longtext.dart +++ b/lib/src/models/attribute_longtext.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeLongtext class AttributeLongtext implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeLongtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + AttributeLongtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory AttributeLongtext.fromMap(Map map) { - return AttributeLongtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeLongtext.fromMap(Map map) { + return AttributeLongtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_mediumtext.dart b/lib/src/models/attribute_mediumtext.dart index 68832e05..ea0417c7 100644 --- a/lib/src/models/attribute_mediumtext.dart +++ b/lib/src/models/attribute_mediumtext.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeMediumtext class AttributeMediumtext implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeMediumtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + AttributeMediumtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory AttributeMediumtext.fromMap(Map map) { - return AttributeMediumtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeMediumtext.fromMap(Map map) { + return AttributeMediumtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_point.dart b/lib/src/models/attribute_point.dart index 73d1250b..51befcd2 100644 --- a/lib/src/models/attribute_point.dart +++ b/lib/src/models/attribute_point.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// AttributePoint class AttributePoint implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final List? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final List? xdefault; - AttributePoint({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributePoint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributePoint.fromMap(Map map) { - return AttributePoint( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory AttributePoint.fromMap(Map map) { + return AttributePoint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_polygon.dart b/lib/src/models/attribute_polygon.dart index 8815fec1..10074e30 100644 --- a/lib/src/models/attribute_polygon.dart +++ b/lib/src/models/attribute_polygon.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// AttributePolygon class AttributePolygon implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final List? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final List? xdefault; - AttributePolygon({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributePolygon({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributePolygon.fromMap(Map map) { - return AttributePolygon( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory AttributePolygon.fromMap(Map map) { + return AttributePolygon( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index de395001..262c6fa3 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,102 +2,101 @@ part of '../../models.dart'; /// AttributeRelationship class AttributeRelationship implements Model { - /// Attribute Key. - final String key; - - /// Attribute type. - final String type; - - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; - - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; - - /// Is attribute required? - final bool xrequired; - - /// Is attribute an array? - final bool? array; - - /// Attribute creation date in ISO 8601 format. - final String $createdAt; - - /// Attribute update date in ISO 8601 format. - final String $updatedAt; - - /// The ID of the related collection. - final String relatedCollection; - - /// The type of the relationship. - final String relationType; - - /// Is the relationship two-way? - final bool twoWay; - - /// The key of the two-way relationship. - final String twoWayKey; - - /// How deleting the parent document will propagate to child documents. - final String onDelete; - - /// Whether this is the parent or child side of the relationship - final String side; - - AttributeRelationship({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.relatedCollection, - required this.relationType, - required this.twoWay, - required this.twoWayKey, - required this.onDelete, - required this.side, - }); - - factory AttributeRelationship.fromMap(Map map) { - return AttributeRelationship( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - relatedCollection: map['relatedCollection'].toString(), - relationType: map['relationType'].toString(), - twoWay: map['twoWay'], - twoWayKey: map['twoWayKey'].toString(), - onDelete: map['onDelete'].toString(), - side: map['side'].toString(), - ); - } - - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "relatedCollection": relatedCollection, - "relationType": relationType, - "twoWay": twoWay, - "twoWayKey": twoWayKey, - "onDelete": onDelete, - "side": side, - }; - } + /// Attribute Key. + final String key; + + /// Attribute type. + final String type; + + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; + + /// Is attribute required? + final bool xrequired; + + /// Is attribute an array? + final bool? array; + + /// Attribute creation date in ISO 8601 format. + final String $createdAt; + + /// Attribute update date in ISO 8601 format. + final String $updatedAt; + + /// The ID of the related collection. + final String relatedCollection; + + /// The type of the relationship. + final String relationType; + + /// Is the relationship two-way? + final bool twoWay; + + /// The key of the two-way relationship. + final String twoWayKey; + + /// How deleting the parent document will propagate to child documents. + final String onDelete; + + /// Whether this is the parent or child side of the relationship + final String side; + + AttributeRelationship({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.relatedCollection, + required this.relationType, + required this.twoWay, + required this.twoWayKey, + required this.onDelete, + required this.side, + }); + + factory AttributeRelationship.fromMap(Map map) { + return AttributeRelationship( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + relatedCollection: map['relatedCollection'].toString(), + relationType: map['relationType'].toString(), + twoWay: map['twoWay'], + twoWayKey: map['twoWayKey'].toString(), + onDelete: map['onDelete'].toString(), + side: map['side'].toString(), + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "relatedCollection": relatedCollection, + "relationType": relationType, + "twoWay": twoWay, + "twoWayKey": twoWayKey, + "onDelete": onDelete, + "side": side, + }; + } } diff --git a/lib/src/models/attribute_string.dart b/lib/src/models/attribute_string.dart index bba7f46d..9154ac0b 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// AttributeString class AttributeString implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Attribute size. - final int size; + /// Attribute size. + final int size; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeString({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + AttributeString({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory AttributeString.fromMap(Map map) { - return AttributeString( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeString.fromMap(Map map) { + return AttributeString( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_text.dart b/lib/src/models/attribute_text.dart index 5a49a975..a1b13f2f 100644 --- a/lib/src/models/attribute_text.dart +++ b/lib/src/models/attribute_text.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeText class AttributeText implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeText({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + AttributeText({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory AttributeText.fromMap(Map map) { - return AttributeText( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeText.fromMap(Map map) { + return AttributeText( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 95ef514a..0fde7dde 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// AttributeURL class AttributeUrl implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeUrl({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeUrl({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeUrl.fromMap(Map map) { - return AttributeUrl( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeUrl.fromMap(Map map) { + return AttributeUrl( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_varchar.dart b/lib/src/models/attribute_varchar.dart index 37b4440e..2b544e49 100644 --- a/lib/src/models/attribute_varchar.dart +++ b/lib/src/models/attribute_varchar.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// AttributeVarchar class AttributeVarchar implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Attribute size. - final int size; + /// Attribute size. + final int size; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeVarchar({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + AttributeVarchar({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory AttributeVarchar.fromMap(Map map) { - return AttributeVarchar( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values - .firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeVarchar.fromMap(Map map) { + return AttributeVarchar( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/auth_provider.dart b/lib/src/models/auth_provider.dart index 5ef17597..79444ca6 100644 --- a/lib/src/models/auth_provider.dart +++ b/lib/src/models/auth_provider.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// AuthProvider class AuthProvider implements Model { - /// Auth Provider. - final String key; - - /// Auth Provider name. - final String name; - - /// OAuth 2.0 application ID. - final String appId; - - /// OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. - final String secret; - - /// Auth Provider is active and can be used to create session. - final bool enabled; - - AuthProvider({ - required this.key, - required this.name, - required this.appId, - required this.secret, - required this.enabled, - }); - - factory AuthProvider.fromMap(Map map) { - return AuthProvider( - key: map['key'].toString(), - name: map['name'].toString(), - appId: map['appId'].toString(), - secret: map['secret'].toString(), - enabled: map['enabled'], - ); - } - - @override - Map toMap() { - return { - "key": key, - "name": name, - "appId": appId, - "secret": secret, - "enabled": enabled, - }; - } + /// Auth Provider. + final String key; + + /// Auth Provider name. + final String name; + + /// OAuth 2.0 application ID. + final String appId; + + /// OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. + final String secret; + + /// Auth Provider is active and can be used to create session. + final bool enabled; + + AuthProvider({ + required this.key, + required this.name, + required this.appId, + required this.secret, + required this.enabled, + }); + + factory AuthProvider.fromMap(Map map) { + return AuthProvider( + key: map['key'].toString(), + name: map['name'].toString(), + appId: map['appId'].toString(), + secret: map['secret'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "key": key, + "name": name, + "appId": appId, + "secret": secret, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/backup_archive.dart b/lib/src/models/backup_archive.dart index 3c995f30..e4f10f69 100644 --- a/lib/src/models/backup_archive.dart +++ b/lib/src/models/backup_archive.dart @@ -2,89 +2,89 @@ part of '../../models.dart'; /// Archive class BackupArchive implements Model { - /// Archive ID. - final String $id; + /// Archive ID. + final String $id; - /// Archive creation time in ISO 8601 format. - final String $createdAt; + /// Archive creation time in ISO 8601 format. + final String $createdAt; - /// Archive update date in ISO 8601 format. - final String $updatedAt; + /// Archive update date in ISO 8601 format. + final String $updatedAt; - /// Archive policy ID. - final String policyId; + /// Archive policy ID. + final String policyId; - /// Archive size in bytes. - final int size; + /// Archive size in bytes. + final int size; - /// The status of the archive creation. Possible values: pending, processing, uploading, completed, failed. - final String status; + /// The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. + final String status; - /// The backup start time. - final String startedAt; + /// The backup start time. + final String startedAt; - /// Migration ID. - final String migrationId; + /// Migration ID. + final String migrationId; - /// The services that are backed up by this archive. - final List services; + /// The services that are backed up by this archive. + final List services; - /// The resources that are backed up by this archive. - final List resources; + /// The resources that are backed up by this archive. + final List resources; - /// The resource ID to backup. Set only if this archive should backup a single resource. - final String? resourceId; + /// The resource ID to backup. Set only if this archive should backup a single resource. + final String? resourceId; - /// The resource type to backup. Set only if this archive should backup a single resource. - final String? resourceType; + /// The resource type to backup. Set only if this archive should backup a single resource. + final String? resourceType; - BackupArchive({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.policyId, - required this.size, - required this.status, - required this.startedAt, - required this.migrationId, - required this.services, - required this.resources, - this.resourceId, - this.resourceType, - }); + BackupArchive({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.policyId, + required this.size, + required this.status, + required this.startedAt, + required this.migrationId, + required this.services, + required this.resources, + this.resourceId, + this.resourceType, + }); - factory BackupArchive.fromMap(Map map) { - return BackupArchive( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - policyId: map['policyId'].toString(), - size: map['size'], - status: map['status'].toString(), - startedAt: map['startedAt'].toString(), - migrationId: map['migrationId'].toString(), - services: List.from(map['services'] ?? []), - resources: List.from(map['resources'] ?? []), - resourceId: map['resourceId']?.toString(), - resourceType: map['resourceType']?.toString(), - ); - } + factory BackupArchive.fromMap(Map map) { + return BackupArchive( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + policyId: map['policyId'].toString(), + size: map['size'], + status: map['status'].toString(), + startedAt: map['startedAt'].toString(), + migrationId: map['migrationId'].toString(), + services: List.from(map['services'] ?? []), + resources: List.from(map['resources'] ?? []), + resourceId: map['resourceId']?.toString(), + resourceType: map['resourceType']?.toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "policyId": policyId, - "size": size, - "status": status, - "startedAt": startedAt, - "migrationId": migrationId, - "services": services, - "resources": resources, - "resourceId": resourceId, - "resourceType": resourceType, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "policyId": policyId, + "size": size, + "status": status, + "startedAt": startedAt, + "migrationId": migrationId, + "services": services, + "resources": resources, + "resourceId": resourceId, + "resourceType": resourceType, + }; + } } diff --git a/lib/src/models/backup_archive_list.dart b/lib/src/models/backup_archive_list.dart index 2ab40493..6e3d4d32 100644 --- a/lib/src/models/backup_archive_list.dart +++ b/lib/src/models/backup_archive_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Backup archive list class BackupArchiveList implements Model { - /// Total number of archives that matched your query. - final int total; + /// Total number of archives that matched your query. + final int total; - /// List of archives. - final List archives; + /// List of archives. + final List archives; - BackupArchiveList({ - required this.total, - required this.archives, - }); + BackupArchiveList({ + required this.total, + required this.archives, + }); - factory BackupArchiveList.fromMap(Map map) { - return BackupArchiveList( - total: map['total'], - archives: List.from( - map['archives'].map((p) => BackupArchive.fromMap(p))), - ); - } + factory BackupArchiveList.fromMap(Map map) { + return BackupArchiveList( + total: map['total'], + archives: List.from(map['archives'].map((p) => BackupArchive.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "archives": archives.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "archives": archives.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/backup_policy.dart b/lib/src/models/backup_policy.dart index c7e1aa2f..892bc89d 100644 --- a/lib/src/models/backup_policy.dart +++ b/lib/src/models/backup_policy.dart @@ -2,83 +2,83 @@ part of '../../models.dart'; /// backup class BackupPolicy implements Model { - /// Backup policy ID. - final String $id; + /// Backup policy ID. + final String $id; - /// Backup policy name. - final String name; + /// Backup policy name. + final String name; - /// Policy creation date in ISO 8601 format. - final String $createdAt; + /// Policy creation date in ISO 8601 format. + final String $createdAt; - /// Policy update date in ISO 8601 format. - final String $updatedAt; + /// Policy update date in ISO 8601 format. + final String $updatedAt; - /// The services that are backed up by this policy. - final List services; + /// The services that are backed up by this policy. + final List services; - /// The resources that are backed up by this policy. - final List resources; + /// The resources that are backed up by this policy. + final List resources; - /// The resource ID to backup. Set only if this policy should backup a single resource. - final String? resourceId; + /// The resource ID to backup. Set only if this policy should backup a single resource. + final String? resourceId; - /// The resource type to backup. Set only if this policy should backup a single resource. - final String? resourceType; + /// The resource type to backup. Set only if this policy should backup a single resource. + final String? resourceType; - /// How many days to keep the backup before it will be automatically deleted. - final int retention; + /// How many days to keep the backup before it will be automatically deleted. + final int retention; - /// Policy backup schedule in CRON format. - final String schedule; + /// Policy backup schedule in CRON format. + final String schedule; - /// Is this policy enabled. - final bool enabled; + /// Is this policy enabled. + final bool enabled; - BackupPolicy({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.services, - required this.resources, - this.resourceId, - this.resourceType, - required this.retention, - required this.schedule, - required this.enabled, - }); + BackupPolicy({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.services, + required this.resources, + this.resourceId, + this.resourceType, + required this.retention, + required this.schedule, + required this.enabled, + }); - factory BackupPolicy.fromMap(Map map) { - return BackupPolicy( - $id: map['\$id'].toString(), - name: map['name'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - services: List.from(map['services'] ?? []), - resources: List.from(map['resources'] ?? []), - resourceId: map['resourceId']?.toString(), - resourceType: map['resourceType']?.toString(), - retention: map['retention'], - schedule: map['schedule'].toString(), - enabled: map['enabled'], - ); - } + factory BackupPolicy.fromMap(Map map) { + return BackupPolicy( + $id: map['\$id'].toString(), + name: map['name'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + services: List.from(map['services'] ?? []), + resources: List.from(map['resources'] ?? []), + resourceId: map['resourceId']?.toString(), + resourceType: map['resourceType']?.toString(), + retention: map['retention'], + schedule: map['schedule'].toString(), + enabled: map['enabled'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "services": services, - "resources": resources, - "resourceId": resourceId, - "resourceType": resourceType, - "retention": retention, - "schedule": schedule, - "enabled": enabled, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "services": services, + "resources": resources, + "resourceId": resourceId, + "resourceType": resourceType, + "retention": retention, + "schedule": schedule, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/backup_policy_list.dart b/lib/src/models/backup_policy_list.dart index da7da51d..a158827a 100644 --- a/lib/src/models/backup_policy_list.dart +++ b/lib/src/models/backup_policy_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Backup policy list class BackupPolicyList implements Model { - /// Total number of policies that matched your query. - final int total; + /// Total number of policies that matched your query. + final int total; - /// List of policies. - final List policies; + /// List of policies. + final List policies; - BackupPolicyList({ - required this.total, - required this.policies, - }); + BackupPolicyList({ + required this.total, + required this.policies, + }); - factory BackupPolicyList.fromMap(Map map) { - return BackupPolicyList( - total: map['total'], - policies: List.from( - map['policies'].map((p) => BackupPolicy.fromMap(p))), - ); - } + factory BackupPolicyList.fromMap(Map map) { + return BackupPolicyList( + total: map['total'], + policies: List.from(map['policies'].map((p) => BackupPolicy.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "policies": policies.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "policies": policies.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/backup_restoration.dart b/lib/src/models/backup_restoration.dart index ad565a5d..16d00c48 100644 --- a/lib/src/models/backup_restoration.dart +++ b/lib/src/models/backup_restoration.dart @@ -2,83 +2,83 @@ part of '../../models.dart'; /// Restoration class BackupRestoration implements Model { - /// Restoration ID. - final String $id; + /// Restoration ID. + final String $id; - /// Restoration creation time in ISO 8601 format. - final String $createdAt; + /// Restoration creation time in ISO 8601 format. + final String $createdAt; - /// Restoration update date in ISO 8601 format. - final String $updatedAt; + /// Restoration update date in ISO 8601 format. + final String $updatedAt; - /// Backup archive ID. - final String archiveId; + /// Backup archive ID. + final String archiveId; - /// Backup policy ID. - final String policyId; + /// Backup policy ID. + final String policyId; - /// The status of the restoration. Possible values: pending, downloading, processing, completed, failed. - final String status; + /// The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + final String status; - /// The backup start time. - final String startedAt; + /// The backup start time. + final String startedAt; - /// Migration ID. - final String migrationId; + /// Migration ID. + final String migrationId; - /// The services that are backed up by this policy. - final List services; + /// The services that are backed up by this policy. + final List services; - /// The resources that are backed up by this policy. - final List resources; + /// The resources that are backed up by this policy. + final List resources; - /// Optional data in key-value object. - final String options; + /// Optional data in key-value object. + final String options; - BackupRestoration({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.archiveId, - required this.policyId, - required this.status, - required this.startedAt, - required this.migrationId, - required this.services, - required this.resources, - required this.options, - }); + BackupRestoration({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.archiveId, + required this.policyId, + required this.status, + required this.startedAt, + required this.migrationId, + required this.services, + required this.resources, + required this.options, + }); - factory BackupRestoration.fromMap(Map map) { - return BackupRestoration( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - archiveId: map['archiveId'].toString(), - policyId: map['policyId'].toString(), - status: map['status'].toString(), - startedAt: map['startedAt'].toString(), - migrationId: map['migrationId'].toString(), - services: List.from(map['services'] ?? []), - resources: List.from(map['resources'] ?? []), - options: map['options'].toString(), - ); - } + factory BackupRestoration.fromMap(Map map) { + return BackupRestoration( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + archiveId: map['archiveId'].toString(), + policyId: map['policyId'].toString(), + status: map['status'].toString(), + startedAt: map['startedAt'].toString(), + migrationId: map['migrationId'].toString(), + services: List.from(map['services'] ?? []), + resources: List.from(map['resources'] ?? []), + options: map['options'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "archiveId": archiveId, - "policyId": policyId, - "status": status, - "startedAt": startedAt, - "migrationId": migrationId, - "services": services, - "resources": resources, - "options": options, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "archiveId": archiveId, + "policyId": policyId, + "status": status, + "startedAt": startedAt, + "migrationId": migrationId, + "services": services, + "resources": resources, + "options": options, + }; + } } diff --git a/lib/src/models/backup_restoration_list.dart b/lib/src/models/backup_restoration_list.dart index f1d3a9f0..8aaf2f46 100644 --- a/lib/src/models/backup_restoration_list.dart +++ b/lib/src/models/backup_restoration_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Backup restoration list class BackupRestorationList implements Model { - /// Total number of restorations that matched your query. - final int total; + /// Total number of restorations that matched your query. + final int total; - /// List of restorations. - final List restorations; + /// List of restorations. + final List restorations; - BackupRestorationList({ - required this.total, - required this.restorations, - }); + BackupRestorationList({ + required this.total, + required this.restorations, + }); - factory BackupRestorationList.fromMap(Map map) { - return BackupRestorationList( - total: map['total'], - restorations: List.from( - map['restorations'].map((p) => BackupRestoration.fromMap(p))), - ); - } + factory BackupRestorationList.fromMap(Map map) { + return BackupRestorationList( + total: map['total'], + restorations: List.from(map['restorations'].map((p) => BackupRestoration.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "restorations": restorations.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "restorations": restorations.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/billing_limits.dart b/lib/src/models/billing_limits.dart index e775c07e..b31a1829 100644 --- a/lib/src/models/billing_limits.dart +++ b/lib/src/models/billing_limits.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// BillingLimits class BillingLimits implements Model { - /// Bandwidth limit - final int bandwidth; + /// Bandwidth limit + final int bandwidth; - /// Storage limit - final int storage; + /// Storage limit + final int storage; - /// Users limit - final int users; + /// Users limit + final int users; - /// Executions limit - final int executions; + /// Executions limit + final int executions; - /// GBHours limit - final int GBHours; + /// GBHours limit + final int GBHours; - /// Image transformations limit - final int imageTransformations; + /// Image transformations limit + final int imageTransformations; - /// Auth phone limit - final int authPhone; + /// Auth phone limit + final int authPhone; - /// Budget limit percentage - final int budgetLimit; + /// Budget limit percentage + final int budgetLimit; - BillingLimits({ - required this.bandwidth, - required this.storage, - required this.users, - required this.executions, - required this.GBHours, - required this.imageTransformations, - required this.authPhone, - required this.budgetLimit, - }); + BillingLimits({ + required this.bandwidth, + required this.storage, + required this.users, + required this.executions, + required this.GBHours, + required this.imageTransformations, + required this.authPhone, + required this.budgetLimit, + }); - factory BillingLimits.fromMap(Map map) { - return BillingLimits( - bandwidth: map['bandwidth'], - storage: map['storage'], - users: map['users'], - executions: map['executions'], - GBHours: map['GBHours'], - imageTransformations: map['imageTransformations'], - authPhone: map['authPhone'], - budgetLimit: map['budgetLimit'], - ); - } + factory BillingLimits.fromMap(Map map) { + return BillingLimits( + bandwidth: map['bandwidth'], + storage: map['storage'], + users: map['users'], + executions: map['executions'], + GBHours: map['GBHours'], + imageTransformations: map['imageTransformations'], + authPhone: map['authPhone'], + budgetLimit: map['budgetLimit'], + ); + } - @override - Map toMap() { - return { - "bandwidth": bandwidth, - "storage": storage, - "users": users, - "executions": executions, - "GBHours": GBHours, - "imageTransformations": imageTransformations, - "authPhone": authPhone, - "budgetLimit": budgetLimit, - }; - } + @override + Map toMap() { + return { + "bandwidth": bandwidth, + "storage": storage, + "users": users, + "executions": executions, + "GBHours": GBHours, + "imageTransformations": imageTransformations, + "authPhone": authPhone, + "budgetLimit": budgetLimit, + }; + } } diff --git a/lib/src/models/block.dart b/lib/src/models/block.dart index 448021a1..71d8af14 100644 --- a/lib/src/models/block.dart +++ b/lib/src/models/block.dart @@ -2,47 +2,77 @@ part of '../../models.dart'; /// Block class Block implements Model { - /// Block creation date in ISO 8601 format. - final String $createdAt; - - /// Resource type that is blocked - final String resourceType; - - /// Resource identifier that is blocked - final String resourceId; - - /// Reason for the block. Can be null if no reason was provided. - final String? reason; - - /// Block expiration date in ISO 8601 format. Can be null if the block does not expire. - final String? expiredAt; - - Block({ - required this.$createdAt, - required this.resourceType, - required this.resourceId, - this.reason, - this.expiredAt, - }); - - factory Block.fromMap(Map map) { - return Block( - $createdAt: map['\$createdAt'].toString(), - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - reason: map['reason']?.toString(), - expiredAt: map['expiredAt']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$createdAt": $createdAt, - "resourceType": resourceType, - "resourceId": resourceId, - "reason": reason, - "expiredAt": expiredAt, - }; - } + /// Block creation date in ISO 8601 format. + final String $createdAt; + + /// Resource type that is blocked + final String resourceType; + + /// Resource identifier that is blocked + final String resourceId; + + /// Reason for the block. Can be null if no reason was provided. + final String? reason; + + /// Block expiration date in ISO 8601 format. Can be null if the block does not expire. + final String? expiredAt; + + /// Name of the project this block applies to. + final String projectName; + + /// Region of the project this block applies to. + final String region; + + /// Name of the organization that owns the project. + final String organizationName; + + /// ID of the organization that owns the project. + final String organizationId; + + /// Billing plan of the organization that owns the project. + final String billingPlan; + + Block({ + required this.$createdAt, + required this.resourceType, + required this.resourceId, + this.reason, + this.expiredAt, + required this.projectName, + required this.region, + required this.organizationName, + required this.organizationId, + required this.billingPlan, + }); + + factory Block.fromMap(Map map) { + return Block( + $createdAt: map['\$createdAt'].toString(), + resourceType: map['resourceType'].toString(), + resourceId: map['resourceId'].toString(), + reason: map['reason']?.toString(), + expiredAt: map['expiredAt']?.toString(), + projectName: map['projectName'].toString(), + region: map['region'].toString(), + organizationName: map['organizationName'].toString(), + organizationId: map['organizationId'].toString(), + billingPlan: map['billingPlan'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$createdAt": $createdAt, + "resourceType": resourceType, + "resourceId": resourceId, + "reason": reason, + "expiredAt": expiredAt, + "projectName": projectName, + "region": region, + "organizationName": organizationName, + "organizationId": organizationId, + "billingPlan": billingPlan, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 2a9d5df8..768062b5 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,101 +2,101 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; - - /// Bucket creation time in ISO 8601 format. - final String $createdAt; - - /// Bucket update date in ISO 8601 format. - final String $updatedAt; - - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; - - /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - final bool fileSecurity; - - /// Bucket name. - final String name; - - /// Bucket enabled. - final bool enabled; - - /// Maximum file size supported. - final int maximumFileSize; - - /// Allowed file extensions. - final List allowedFileExtensions; - - /// Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - final String compression; - - /// Bucket is encrypted. - final bool encryption; - - /// Virus scanning is enabled. - final bool antivirus; - - /// Image transformations are enabled. - final bool transformations; - - /// Total size of this bucket in bytes. - final int totalSize; - - Bucket({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.fileSecurity, - required this.name, - required this.enabled, - required this.maximumFileSize, - required this.allowedFileExtensions, - required this.compression, - required this.encryption, - required this.antivirus, - required this.transformations, - required this.totalSize, - }); - - factory Bucket.fromMap(Map map) { - return Bucket( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - fileSecurity: map['fileSecurity'], - name: map['name'].toString(), - enabled: map['enabled'], - maximumFileSize: map['maximumFileSize'], - allowedFileExtensions: List.from(map['allowedFileExtensions'] ?? []), - compression: map['compression'].toString(), - encryption: map['encryption'], - antivirus: map['antivirus'], - transformations: map['transformations'], - totalSize: map['totalSize'], - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "fileSecurity": fileSecurity, - "name": name, - "enabled": enabled, - "maximumFileSize": maximumFileSize, - "allowedFileExtensions": allowedFileExtensions, - "compression": compression, - "encryption": encryption, - "antivirus": antivirus, - "transformations": transformations, - "totalSize": totalSize, - }; - } + /// Bucket ID. + final String $id; + + /// Bucket creation time in ISO 8601 format. + final String $createdAt; + + /// Bucket update date in ISO 8601 format. + final String $updatedAt; + + /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; + + /// Bucket name. + final String name; + + /// Bucket enabled. + final bool enabled; + + /// Maximum file size supported. + final int maximumFileSize; + + /// Allowed file extensions. + final List allowedFileExtensions; + + /// Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + final String compression; + + /// Bucket is encrypted. + final bool encryption; + + /// Virus scanning is enabled. + final bool antivirus; + + /// Image transformations are enabled. + final bool transformations; + + /// Total size of this bucket in bytes. + final int totalSize; + + Bucket({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.fileSecurity, + required this.name, + required this.enabled, + required this.maximumFileSize, + required this.allowedFileExtensions, + required this.compression, + required this.encryption, + required this.antivirus, + required this.transformations, + required this.totalSize, + }); + + factory Bucket.fromMap(Map map) { + return Bucket( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + fileSecurity: map['fileSecurity'], + name: map['name'].toString(), + enabled: map['enabled'], + maximumFileSize: map['maximumFileSize'], + allowedFileExtensions: List.from(map['allowedFileExtensions'] ?? []), + compression: map['compression'].toString(), + encryption: map['encryption'], + antivirus: map['antivirus'], + transformations: map['transformations'], + totalSize: map['totalSize'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "fileSecurity": fileSecurity, + "name": name, + "enabled": enabled, + "maximumFileSize": maximumFileSize, + "allowedFileExtensions": allowedFileExtensions, + "compression": compression, + "encryption": encryption, + "antivirus": antivirus, + "transformations": transformations, + "totalSize": totalSize, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 5be8fa5d..20017cd2 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets that matched your query. - final int total; + /// Total number of buckets that matched your query. + final int total; - /// List of buckets. - final List buckets; + /// List of buckets. + final List buckets; - BucketList({ - required this.total, - required this.buckets, - }); + BucketList({ + required this.total, + required this.buckets, + }); - factory BucketList.fromMap(Map map) { - return BucketList( - total: map['total'], - buckets: List.from(map['buckets'].map((p) => Bucket.fromMap(p))), - ); - } + factory BucketList.fromMap(Map map) { + return BucketList( + total: map['total'], + buckets: List.from(map['buckets'].map((p) => Bucket.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "buckets": buckets.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/collection.dart b/lib/src/models/collection.dart index 70c9ddde..11e8e347 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,89 +2,89 @@ part of '../../models.dart'; /// Collection class Collection implements Model { - /// Collection ID. - final String $id; + /// Collection ID. + final String $id; - /// Collection creation date in ISO 8601 format. - final String $createdAt; + /// Collection creation date in ISO 8601 format. + final String $createdAt; - /// Collection update date in ISO 8601 format. - final String $updatedAt; + /// Collection update date in ISO 8601 format. + final String $updatedAt; - /// Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// Database ID. - final String databaseId; + /// Database ID. + final String databaseId; - /// Collection name. - final String name; + /// Collection name. + final String name; - /// Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. - final bool enabled; + /// Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. + final bool enabled; - /// Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - final bool documentSecurity; + /// Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool documentSecurity; - /// Collection attributes. - final List attributes; + /// Collection attributes. + final List attributes; - /// Collection indexes. - final List indexes; + /// Collection indexes. + final List indexes; - /// Maximum document size in bytes. Returns 0 when no limit applies. - final int bytesMax; + /// Maximum document size in bytes. Returns 0 when no limit applies. + final int bytesMax; - /// Currently used document size in bytes based on defined attributes. - final int bytesUsed; + /// Currently used document size in bytes based on defined attributes. + final int bytesUsed; - Collection({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.databaseId, - required this.name, - required this.enabled, - required this.documentSecurity, - required this.attributes, - required this.indexes, - required this.bytesMax, - required this.bytesUsed, - }); + Collection({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.databaseId, + required this.name, + required this.enabled, + required this.documentSecurity, + required this.attributes, + required this.indexes, + required this.bytesMax, + required this.bytesUsed, + }); - factory Collection.fromMap(Map map) { - return Collection( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - databaseId: map['databaseId'].toString(), - name: map['name'].toString(), - enabled: map['enabled'], - documentSecurity: map['documentSecurity'], - attributes: List.from(map['attributes'] ?? []), - indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), - bytesMax: map['bytesMax'], - bytesUsed: map['bytesUsed'], - ); - } + factory Collection.fromMap(Map map) { + return Collection( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + databaseId: map['databaseId'].toString(), + name: map['name'].toString(), + enabled: map['enabled'], + documentSecurity: map['documentSecurity'], + attributes: List.from(map['attributes'] ?? []), + indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), + bytesMax: map['bytesMax'], + bytesUsed: map['bytesUsed'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "databaseId": databaseId, - "name": name, - "enabled": enabled, - "documentSecurity": documentSecurity, - "attributes": attributes, - "indexes": indexes.map((p) => p.toMap()).toList(), - "bytesMax": bytesMax, - "bytesUsed": bytesUsed, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "databaseId": databaseId, + "name": name, + "enabled": enabled, + "documentSecurity": documentSecurity, + "attributes": attributes, + "indexes": indexes.map((p) => p.toMap()).toList(), + "bytesMax": bytesMax, + "bytesUsed": bytesUsed, + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index c46ad20e..10376235 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections that matched your query. - final int total; + /// Total number of collections that matched your query. + final int total; - /// List of collections. - final List collections; + /// List of collections. + final List collections; - CollectionList({ - required this.total, - required this.collections, - }); + CollectionList({ + required this.total, + required this.collections, + }); - factory CollectionList.fromMap(Map map) { - return CollectionList( - total: map['total'], - collections: List.from( - map['collections'].map((p) => Collection.fromMap(p))), - ); - } + factory CollectionList.fromMap(Map map) { + return CollectionList( + total: map['total'], + collections: List.from(map['collections'].map((p) => Collection.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_bigint.dart b/lib/src/models/column_bigint.dart new file mode 100644 index 00000000..1a93f9d9 --- /dev/null +++ b/lib/src/models/column_bigint.dart @@ -0,0 +1,84 @@ +part of '../../models.dart'; + +/// ColumnBigInt +class ColumnBigint implements Model { + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; + + /// Is column required? + final bool xrequired; + + /// Is column an array? + final bool? array; + + /// Column creation date in ISO 8601 format. + final String $createdAt; + + /// Column update date in ISO 8601 format. + final String $updatedAt; + + /// Minimum value to enforce for new documents. + final int? min; + + /// Maximum value to enforce for new documents. + final int? max; + + /// Default value for column when not provided. Cannot be set when column is required. + final int? xdefault; + + ColumnBigint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); + + factory ColumnBigint.fromMap(Map map) { + return ColumnBigint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } +} diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 09aaf59d..17a41b53 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// ColumnBoolean class ColumnBoolean implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final bool? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final bool? xdefault; - ColumnBoolean({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnBoolean({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnBoolean.fromMap(Map map) { - return ColumnBoolean( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default'], - ); - } + factory ColumnBoolean.fromMap(Map map) { + return ColumnBoolean( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_datetime.dart b/lib/src/models/column_datetime.dart index dd347a8f..b75741f9 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnDatetime class ColumnDatetime implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// ISO 8601 format. - final String format; + /// ISO 8601 format. + final String format; - /// Default value for column when not provided. Only null is optional - final String? xdefault; + /// Default value for column when not provided. Only null is optional + final String? xdefault; - ColumnDatetime({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnDatetime({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnDatetime.fromMap(Map map) { - return ColumnDatetime( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnDatetime.fromMap(Map map) { + return ColumnDatetime( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_email.dart b/lib/src/models/column_email.dart index 24bc025d..9103b043 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnEmail class ColumnEmail implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnEmail({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnEmail({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnEmail.fromMap(Map map) { - return ColumnEmail( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnEmail.fromMap(Map map) { + return ColumnEmail( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_enum.dart b/lib/src/models/column_enum.dart index 0138a664..0eae5565 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// ColumnEnum class ColumnEnum implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Array of elements in enumerated type. - final List elements; + /// Array of elements in enumerated type. + final List elements; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnEnum({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.elements, - required this.format, - this.xdefault, - }); + ColumnEnum({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.elements, + required this.format, + this.xdefault, + }); - factory ColumnEnum.fromMap(Map map) { - return ColumnEnum( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - elements: List.from(map['elements'] ?? []), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnEnum.fromMap(Map map) { + return ColumnEnum( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + elements: List.from(map['elements'] ?? []), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "elements": elements, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_float.dart b/lib/src/models/column_float.dart index 63dc80c6..499fb886 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// ColumnFloat class ColumnFloat implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final double? min; + /// Minimum value to enforce for new documents. + final double? min; - /// Maximum value to enforce for new documents. - final double? max; + /// Maximum value to enforce for new documents. + final double? max; - /// Default value for column when not provided. Cannot be set when column is required. - final double? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final double? xdefault; - ColumnFloat({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + ColumnFloat({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory ColumnFloat.fromMap(Map map) { - return ColumnFloat( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min']?.toDouble(), - max: map['max']?.toDouble(), - xdefault: map['default']?.toDouble(), - ); - } + factory ColumnFloat.fromMap(Map map) { + return ColumnFloat( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min']?.toDouble(), + max: map['max']?.toDouble(), + xdefault: map['default']?.toDouble(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_index.dart b/lib/src/models/column_index.dart index 3bc4f883..24202a9a 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,77 +2,77 @@ part of '../../models.dart'; /// Index class ColumnIndex implements Model { - /// Index ID. - final String $id; + /// Index ID. + final String $id; - /// Index creation date in ISO 8601 format. - final String $createdAt; + /// Index creation date in ISO 8601 format. + final String $createdAt; - /// Index update date in ISO 8601 format. - final String $updatedAt; + /// Index update date in ISO 8601 format. + final String $updatedAt; - /// Index Key. - final String key; + /// Index Key. + final String key; - /// Index type. - final String type; + /// Index type. + final String type; - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final String status; + /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String status; - /// Error message. Displays error generated on failure of creating or deleting an index. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an index. + final String error; - /// Index columns. - final List columns; + /// Index columns. + final List columns; - /// Index columns length. - final List lengths; + /// Index columns length. + final List lengths; - /// Index orders. - final List? orders; + /// Index orders. + final List? orders; - ColumnIndex({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.key, - required this.type, - required this.status, - required this.error, - required this.columns, - required this.lengths, - this.orders, - }); + ColumnIndex({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.key, + required this.type, + required this.status, + required this.error, + required this.columns, + required this.lengths, + this.orders, + }); - factory ColumnIndex.fromMap(Map map) { - return ColumnIndex( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - key: map['key'].toString(), - type: map['type'].toString(), - status: map['status'].toString(), - error: map['error'].toString(), - columns: List.from(map['columns'] ?? []), - lengths: List.from(map['lengths'] ?? []), - orders: List.from(map['orders'] ?? []), - ); - } + factory ColumnIndex.fromMap(Map map) { + return ColumnIndex( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + error: map['error'].toString(), + columns: List.from(map['columns'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "error": error, + "columns": columns, + "lengths": lengths, + "orders": orders, + }; + } } diff --git a/lib/src/models/column_index_list.dart b/lib/src/models/column_index_list.dart index 7d7d2fd4..146ecf21 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes that matched your query. - final int total; + /// Total number of indexes that matched your query. + final int total; - /// List of indexes. - final List indexes; + /// List of indexes. + final List indexes; - ColumnIndexList({ - required this.total, - required this.indexes, - }); + ColumnIndexList({ + required this.total, + required this.indexes, + }); - factory ColumnIndexList.fromMap(Map map) { - return ColumnIndexList( - total: map['total'], - indexes: List.from( - map['indexes'].map((p) => ColumnIndex.fromMap(p))), - ); - } + factory ColumnIndexList.fromMap(Map map) { + return ColumnIndexList( + total: map['total'], + indexes: List.from(map['indexes'].map((p) => ColumnIndex.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "indexes": indexes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_integer.dart b/lib/src/models/column_integer.dart index 0e71ba39..9d166622 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// ColumnInteger class ColumnInteger implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final int? min; + /// Minimum value to enforce for new documents. + final int? min; - /// Maximum value to enforce for new documents. - final int? max; + /// Maximum value to enforce for new documents. + final int? max; - /// Default value for column when not provided. Cannot be set when column is required. - final int? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final int? xdefault; - ColumnInteger({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + ColumnInteger({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory ColumnInteger.fromMap(Map map) { - return ColumnInteger( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min'], - max: map['max'], - xdefault: map['default'], - ); - } + factory ColumnInteger.fromMap(Map map) { + return ColumnInteger( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_ip.dart b/lib/src/models/column_ip.dart index 2e896eb7..d9863c3a 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnIP class ColumnIp implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnIp({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnIp({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnIp.fromMap(Map map) { - return ColumnIp( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnIp.fromMap(Map map) { + return ColumnIp( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_line.dart b/lib/src/models/column_line.dart index 9832b853..12a081ef 100644 --- a/lib/src/models/column_line.dart +++ b/lib/src/models/column_line.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// ColumnLine class ColumnLine implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final List? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final List? xdefault; - ColumnLine({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnLine({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnLine.fromMap(Map map) { - return ColumnLine( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory ColumnLine.fromMap(Map map) { + return ColumnLine( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index 548c1d4a..fc3e265e 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Columns List class ColumnList implements Model { - /// Total number of columns in the given table. - final int total; + /// Total number of columns in the given table. + final int total; - /// List of columns. - final List columns; + /// List of columns. + final List columns; - ColumnList({ - required this.total, - required this.columns, - }); + ColumnList({ + required this.total, + required this.columns, + }); - factory ColumnList.fromMap(Map map) { - return ColumnList( - total: map['total'], - columns: List.from(map['columns'] ?? []), - ); - } + factory ColumnList.fromMap(Map map) { + return ColumnList( + total: map['total'], + columns: List.from(map['columns'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + @override + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_longtext.dart b/lib/src/models/column_longtext.dart index 7d9d87ed..397a0eb7 100644 --- a/lib/src/models/column_longtext.dart +++ b/lib/src/models/column_longtext.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnLongtext class ColumnLongtext implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnLongtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + ColumnLongtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory ColumnLongtext.fromMap(Map map) { - return ColumnLongtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnLongtext.fromMap(Map map) { + return ColumnLongtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_mediumtext.dart b/lib/src/models/column_mediumtext.dart index 326176ea..47134b91 100644 --- a/lib/src/models/column_mediumtext.dart +++ b/lib/src/models/column_mediumtext.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnMediumtext class ColumnMediumtext implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnMediumtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + ColumnMediumtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory ColumnMediumtext.fromMap(Map map) { - return ColumnMediumtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnMediumtext.fromMap(Map map) { + return ColumnMediumtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_point.dart b/lib/src/models/column_point.dart index 7b6ce167..d84da2b3 100644 --- a/lib/src/models/column_point.dart +++ b/lib/src/models/column_point.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// ColumnPoint class ColumnPoint implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final List? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final List? xdefault; - ColumnPoint({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnPoint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnPoint.fromMap(Map map) { - return ColumnPoint( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory ColumnPoint.fromMap(Map map) { + return ColumnPoint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_polygon.dart b/lib/src/models/column_polygon.dart index 97d7ee80..0e469c20 100644 --- a/lib/src/models/column_polygon.dart +++ b/lib/src/models/column_polygon.dart @@ -2,72 +2,71 @@ part of '../../models.dart'; /// ColumnPolygon class ColumnPolygon implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final List? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final List? xdefault; - ColumnPolygon({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnPolygon({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnPolygon.fromMap(Map map) { - return ColumnPolygon( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory ColumnPolygon.fromMap(Map map) { + return ColumnPolygon( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index cf48ef07..68b6f013 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,102 +2,101 @@ part of '../../models.dart'; /// ColumnRelationship class ColumnRelationship implements Model { - /// Column Key. - final String key; - - /// Column type. - final String type; - - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; - - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; - - /// Is column required? - final bool xrequired; - - /// Is column an array? - final bool? array; - - /// Column creation date in ISO 8601 format. - final String $createdAt; - - /// Column update date in ISO 8601 format. - final String $updatedAt; - - /// The ID of the related table. - final String relatedTable; - - /// The type of the relationship. - final String relationType; - - /// Is the relationship two-way? - final bool twoWay; - - /// The key of the two-way relationship. - final String twoWayKey; - - /// How deleting the parent document will propagate to child documents. - final String onDelete; - - /// Whether this is the parent or child side of the relationship - final String side; - - ColumnRelationship({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.relatedTable, - required this.relationType, - required this.twoWay, - required this.twoWayKey, - required this.onDelete, - required this.side, - }); - - factory ColumnRelationship.fromMap(Map map) { - return ColumnRelationship( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - relatedTable: map['relatedTable'].toString(), - relationType: map['relationType'].toString(), - twoWay: map['twoWay'], - twoWayKey: map['twoWayKey'].toString(), - onDelete: map['onDelete'].toString(), - side: map['side'].toString(), - ); - } - - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "relatedTable": relatedTable, - "relationType": relationType, - "twoWay": twoWay, - "twoWayKey": twoWayKey, - "onDelete": onDelete, - "side": side, - }; - } + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; + + /// Is column required? + final bool xrequired; + + /// Is column an array? + final bool? array; + + /// Column creation date in ISO 8601 format. + final String $createdAt; + + /// Column update date in ISO 8601 format. + final String $updatedAt; + + /// The ID of the related table. + final String relatedTable; + + /// The type of the relationship. + final String relationType; + + /// Is the relationship two-way? + final bool twoWay; + + /// The key of the two-way relationship. + final String twoWayKey; + + /// How deleting the parent document will propagate to child documents. + final String onDelete; + + /// Whether this is the parent or child side of the relationship + final String side; + + ColumnRelationship({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.relatedTable, + required this.relationType, + required this.twoWay, + required this.twoWayKey, + required this.onDelete, + required this.side, + }); + + factory ColumnRelationship.fromMap(Map map) { + return ColumnRelationship( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + relatedTable: map['relatedTable'].toString(), + relationType: map['relationType'].toString(), + twoWay: map['twoWay'], + twoWayKey: map['twoWayKey'].toString(), + onDelete: map['onDelete'].toString(), + side: map['side'].toString(), + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "relatedTable": relatedTable, + "relationType": relationType, + "twoWay": twoWay, + "twoWayKey": twoWayKey, + "onDelete": onDelete, + "side": side, + }; + } } diff --git a/lib/src/models/column_string.dart b/lib/src/models/column_string.dart index a0feb3fd..9d687480 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// ColumnString class ColumnString implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Column size. - final int size; + /// Column size. + final int size; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnString({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + ColumnString({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory ColumnString.fromMap(Map map) { - return ColumnString( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnString.fromMap(Map map) { + return ColumnString( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_text.dart b/lib/src/models/column_text.dart index 51eb10ee..27a35251 100644 --- a/lib/src/models/column_text.dart +++ b/lib/src/models/column_text.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnText class ColumnText implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnText({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + ColumnText({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory ColumnText.fromMap(Map map) { - return ColumnText( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnText.fromMap(Map map) { + return ColumnText( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index b6eb4254..d2faf233 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// ColumnURL class ColumnUrl implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnUrl({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnUrl({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnUrl.fromMap(Map map) { - return ColumnUrl( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnUrl.fromMap(Map map) { + return ColumnUrl( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_varchar.dart b/lib/src/models/column_varchar.dart index 2a6cf042..5540e0fb 100644 --- a/lib/src/models/column_varchar.dart +++ b/lib/src/models/column_varchar.dart @@ -2,84 +2,83 @@ part of '../../models.dart'; /// ColumnVarchar class ColumnVarchar implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Column size. - final int size; + /// Column size. + final int size; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnVarchar({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + ColumnVarchar({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory ColumnVarchar.fromMap(Map map) { - return ColumnVarchar( - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnVarchar.fromMap(Map map) { + return ColumnVarchar( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index ec3c41be..930900bf 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Continent class Continent implements Model { - /// Continent name. - final String name; + /// Continent name. + final String name; - /// Continent two letter code. - final String code; + /// Continent two letter code. + final String code; - Continent({ - required this.name, - required this.code, - }); + Continent({ + required this.name, + required this.code, + }); - factory Continent.fromMap(Map map) { - return Continent( - name: map['name'].toString(), - code: map['code'].toString(), - ); - } + factory Continent.fromMap(Map map) { + return Continent( + name: map['name'].toString(), + code: map['code'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "code": code, - }; - } + @override + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index df28f04b..753bcacc 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents that matched your query. - final int total; + /// Total number of continents that matched your query. + final int total; - /// List of continents. - final List continents; + /// List of continents. + final List continents; - ContinentList({ - required this.total, - required this.continents, - }); + ContinentList({ + required this.total, + required this.continents, + }); - factory ContinentList.fromMap(Map map) { - return ContinentList( - total: map['total'], - continents: List.from( - map['continents'].map((p) => Continent.fromMap(p))), - ); - } + factory ContinentList.fromMap(Map map) { + return ContinentList( + total: map['total'], + continents: List.from(map['continents'].map((p) => Continent.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "continents": continents.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/country.dart b/lib/src/models/country.dart index 3bcbb76d..c4838ba3 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Country class Country implements Model { - /// Country name. - final String name; + /// Country name. + final String name; - /// Country two-character ISO 3166-1 alpha code. - final String code; + /// Country two-character ISO 3166-1 alpha code. + final String code; - Country({ - required this.name, - required this.code, - }); + Country({ + required this.name, + required this.code, + }); - factory Country.fromMap(Map map) { - return Country( - name: map['name'].toString(), - code: map['code'].toString(), - ); - } + factory Country.fromMap(Map map) { + return Country( + name: map['name'].toString(), + code: map['code'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "code": code, - }; - } + @override + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index 79cb1256..f363a54b 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries that matched your query. - final int total; + /// Total number of countries that matched your query. + final int total; - /// List of countries. - final List countries; + /// List of countries. + final List countries; - CountryList({ - required this.total, - required this.countries, - }); + CountryList({ + required this.total, + required this.countries, + }); - factory CountryList.fromMap(Map map) { - return CountryList( - total: map['total'], - countries: - List.from(map['countries'].map((p) => Country.fromMap(p))), - ); - } + factory CountryList.fromMap(Map map) { + return CountryList( + total: map['total'], + countries: List.from(map['countries'].map((p) => Country.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "countries": countries.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/currency.dart b/lib/src/models/currency.dart index f2b18093..b6bb455f 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,59 +2,59 @@ part of '../../models.dart'; /// Currency class Currency implements Model { - /// Currency symbol. - final String symbol; - - /// Currency name. - final String name; - - /// Currency native symbol. - final String symbolNative; - - /// Number of decimal digits. - final int decimalDigits; - - /// Currency digit rounding. - final double rounding; - - /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. - final String code; - - /// Currency plural name - final String namePlural; - - Currency({ - required this.symbol, - required this.name, - required this.symbolNative, - required this.decimalDigits, - required this.rounding, - required this.code, - required this.namePlural, - }); - - factory Currency.fromMap(Map map) { - return Currency( - symbol: map['symbol'].toString(), - name: map['name'].toString(), - symbolNative: map['symbolNative'].toString(), - decimalDigits: map['decimalDigits'], - rounding: map['rounding'].toDouble(), - code: map['code'].toString(), - namePlural: map['namePlural'].toString(), - ); - } - - @override - Map toMap() { - return { - "symbol": symbol, - "name": name, - "symbolNative": symbolNative, - "decimalDigits": decimalDigits, - "rounding": rounding, - "code": code, - "namePlural": namePlural, - }; - } + /// Currency symbol. + final String symbol; + + /// Currency name. + final String name; + + /// Currency native symbol. + final String symbolNative; + + /// Number of decimal digits. + final int decimalDigits; + + /// Currency digit rounding. + final double rounding; + + /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + final String code; + + /// Currency plural name + final String namePlural; + + Currency({ + required this.symbol, + required this.name, + required this.symbolNative, + required this.decimalDigits, + required this.rounding, + required this.code, + required this.namePlural, + }); + + factory Currency.fromMap(Map map) { + return Currency( + symbol: map['symbol'].toString(), + name: map['name'].toString(), + symbolNative: map['symbolNative'].toString(), + decimalDigits: map['decimalDigits'], + rounding: map['rounding'].toDouble(), + code: map['code'].toString(), + namePlural: map['namePlural'].toString(), + ); + } + + @override + Map toMap() { + return { + "symbol": symbol, + "name": name, + "symbolNative": symbolNative, + "decimalDigits": decimalDigits, + "rounding": rounding, + "code": code, + "namePlural": namePlural, + }; + } } diff --git a/lib/src/models/currency_list.dart b/lib/src/models/currency_list.dart index 6c39ae2e..eb2bad19 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies that matched your query. - final int total; + /// Total number of currencies that matched your query. + final int total; - /// List of currencies. - final List currencies; + /// List of currencies. + final List currencies; - CurrencyList({ - required this.total, - required this.currencies, - }); + CurrencyList({ + required this.total, + required this.currencies, + }); - factory CurrencyList.fromMap(Map map) { - return CurrencyList( - total: map['total'], - currencies: List.from( - map['currencies'].map((p) => Currency.fromMap(p))), - ); - } + factory CurrencyList.fromMap(Map map) { + return CurrencyList( + total: map['total'], + currencies: List.from(map['currencies'].map((p) => Currency.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "currencies": currencies.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/database.dart b/lib/src/models/database.dart index 432d94b2..a40496ea 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,66 +2,65 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; + /// Database ID. + final String $id; - /// Database name. - final String name; + /// Database name. + final String name; - /// Database creation date in ISO 8601 format. - final String $createdAt; + /// Database creation date in ISO 8601 format. + final String $createdAt; - /// Database update date in ISO 8601 format. - final String $updatedAt; + /// Database update date in ISO 8601 format. + final String $updatedAt; - /// If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. - final bool enabled; + /// If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. + final bool enabled; - /// Database type. - final enums.DatabaseType type; + /// Database type. + final enums.DatabaseType type; - /// Database backup policies. - final List policies; + /// Database backup policies. + final List policies; - /// Database backup archives. - final List archives; + /// Database backup archives. + final List archives; - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - required this.policies, - required this.archives, - }); + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + required this.policies, + required this.archives, + }); - factory Database.fromMap(Map map) { - return Database( - $id: map['\$id'].toString(), - name: map['name'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - enabled: map['enabled'], - type: enums.DatabaseType.values.firstWhere((e) => e.value == map['type']), - policies: List.from(map['policies'].map((p) => Index.fromMap(p))), - archives: List.from( - map['archives'].map((p) => Collection.fromMap(p))), - ); - } + factory Database.fromMap(Map map) { + return Database( + $id: map['\$id'].toString(), + name: map['name'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + enabled: map['enabled'], + type: enums.DatabaseType.values.firstWhere((e) => e.value == map['type']), + policies: List.from(map['policies'].map((p) => Index.fromMap(p))), + archives: List.from(map['archives'].map((p) => Collection.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type.value, - "policies": policies.map((p) => p.toMap()).toList(), - "archives": archives.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type.value, + "policies": policies.map((p) => p.toMap()).toList(), + "archives": archives.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index 1af1b466..dc6c7f62 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases that matched your query. - final int total; + /// Total number of databases that matched your query. + final int total; - /// List of databases. - final List databases; + /// List of databases. + final List databases; - DatabaseList({ - required this.total, - required this.databases, - }); + DatabaseList({ + required this.total, + required this.databases, + }); - factory DatabaseList.fromMap(Map map) { - return DatabaseList( - total: map['total'], - databases: - List.from(map['databases'].map((p) => Database.fromMap(p))), - ); - } + factory DatabaseList.fromMap(Map map) { + return DatabaseList( + total: map['total'], + databases: List.from(map['databases'].map((p) => Database.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "databases": databases.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/deployment.dart b/lib/src/models/deployment.dart index dec00090..901361ea 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,180 +2,179 @@ part of '../../models.dart'; /// Deployment class Deployment implements Model { - /// Deployment ID. - final String $id; + /// Deployment ID. + final String $id; - /// Deployment creation date in ISO 8601 format. - final String $createdAt; + /// Deployment creation date in ISO 8601 format. + final String $createdAt; - /// Deployment update date in ISO 8601 format. - final String $updatedAt; + /// Deployment update date in ISO 8601 format. + final String $updatedAt; - /// Type of deployment. - final String type; + /// Type of deployment. + final String type; - /// Resource ID. - final String resourceId; + /// Resource ID. + final String resourceId; - /// Resource type. - final String resourceType; - - /// The entrypoint file to use to execute the deployment code. - final String entrypoint; - - /// The code size in bytes. - final int sourceSize; - - /// The build output size in bytes. - final int buildSize; - - /// The total size in bytes (source and build output). - final int totalSize; - - /// The current build ID. - final String buildId; - - /// Whether the deployment should be automatically activated. - final bool activate; - - /// Screenshot with light theme preference file ID. - final String screenshotLight; - - /// Screenshot with dark theme preference file ID. - final String screenshotDark; - - /// The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". - final enums.DeploymentStatus status; - - /// The build logs. - final String buildLogs; - - /// The current build time in seconds. - final int buildDuration; - - /// The name of the vcs provider repository - final String providerRepositoryName; - - /// The name of the vcs provider repository owner - final String providerRepositoryOwner; - - /// The url of the vcs provider repository - final String providerRepositoryUrl; - - /// The commit hash of the vcs commit - final String providerCommitHash; - - /// The url of vcs commit author - final String providerCommitAuthorUrl; - - /// The name of vcs commit author - final String providerCommitAuthor; - - /// The commit message - final String providerCommitMessage; - - /// The url of the vcs commit - final String providerCommitUrl; - - /// The branch of the vcs repository - final String providerBranch; - - /// The branch of the vcs repository - final String providerBranchUrl; - - Deployment({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.type, - required this.resourceId, - required this.resourceType, - required this.entrypoint, - required this.sourceSize, - required this.buildSize, - required this.totalSize, - required this.buildId, - required this.activate, - required this.screenshotLight, - required this.screenshotDark, - required this.status, - required this.buildLogs, - required this.buildDuration, - required this.providerRepositoryName, - required this.providerRepositoryOwner, - required this.providerRepositoryUrl, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - required this.providerBranch, - required this.providerBranchUrl, - }); - - factory Deployment.fromMap(Map map) { - return Deployment( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - type: map['type'].toString(), - resourceId: map['resourceId'].toString(), - resourceType: map['resourceType'].toString(), - entrypoint: map['entrypoint'].toString(), - sourceSize: map['sourceSize'], - buildSize: map['buildSize'], - totalSize: map['totalSize'], - buildId: map['buildId'].toString(), - activate: map['activate'], - screenshotLight: map['screenshotLight'].toString(), - screenshotDark: map['screenshotDark'].toString(), - status: enums.DeploymentStatus.values - .firstWhere((e) => e.value == map['status']), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "type": type, - "resourceId": resourceId, - "resourceType": resourceType, - "entrypoint": entrypoint, - "sourceSize": sourceSize, - "buildSize": buildSize, - "totalSize": totalSize, - "buildId": buildId, - "activate": activate, - "screenshotLight": screenshotLight, - "screenshotDark": screenshotDark, - "status": status.value, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "providerBranch": providerBranch, - "providerBranchUrl": providerBranchUrl, - }; - } + /// Resource type. + final String resourceType; + + /// The entrypoint file to use to execute the deployment code. + final String entrypoint; + + /// The code size in bytes. + final int sourceSize; + + /// The build output size in bytes. + final int buildSize; + + /// The total size in bytes (source and build output). + final int totalSize; + + /// The current build ID. + final String buildId; + + /// Whether the deployment should be automatically activated. + final bool activate; + + /// Screenshot with light theme preference file ID. + final String screenshotLight; + + /// Screenshot with dark theme preference file ID. + final String screenshotDark; + + /// The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". + final enums.DeploymentStatus status; + + /// The build logs. + final String buildLogs; + + /// The current build time in seconds. + final int buildDuration; + + /// The name of the vcs provider repository + final String providerRepositoryName; + + /// The name of the vcs provider repository owner + final String providerRepositoryOwner; + + /// The url of the vcs provider repository + final String providerRepositoryUrl; + + /// The commit hash of the vcs commit + final String providerCommitHash; + + /// The url of vcs commit author + final String providerCommitAuthorUrl; + + /// The name of vcs commit author + final String providerCommitAuthor; + + /// The commit message + final String providerCommitMessage; + + /// The url of the vcs commit + final String providerCommitUrl; + + /// The branch of the vcs repository + final String providerBranch; + + /// The branch of the vcs repository + final String providerBranchUrl; + + Deployment({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.type, + required this.resourceId, + required this.resourceType, + required this.entrypoint, + required this.sourceSize, + required this.buildSize, + required this.totalSize, + required this.buildId, + required this.activate, + required this.screenshotLight, + required this.screenshotDark, + required this.status, + required this.buildLogs, + required this.buildDuration, + required this.providerRepositoryName, + required this.providerRepositoryOwner, + required this.providerRepositoryUrl, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + required this.providerBranch, + required this.providerBranchUrl, + }); + + factory Deployment.fromMap(Map map) { + return Deployment( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + type: map['type'].toString(), + resourceId: map['resourceId'].toString(), + resourceType: map['resourceType'].toString(), + entrypoint: map['entrypoint'].toString(), + sourceSize: map['sourceSize'], + buildSize: map['buildSize'], + totalSize: map['totalSize'], + buildId: map['buildId'].toString(), + activate: map['activate'], + screenshotLight: map['screenshotLight'].toString(), + screenshotDark: map['screenshotDark'].toString(), + status: enums.DeploymentStatus.values.firstWhere((e) => e.value == map['status']), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "type": type, + "resourceId": resourceId, + "resourceType": resourceType, + "entrypoint": entrypoint, + "sourceSize": sourceSize, + "buildSize": buildSize, + "totalSize": totalSize, + "buildId": buildId, + "activate": activate, + "screenshotLight": screenshotLight, + "screenshotDark": screenshotDark, + "status": status.value, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranch": providerBranch, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 38dfc9b7..57789751 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments that matched your query. - final int total; + /// Total number of deployments that matched your query. + final int total; - /// List of deployments. - final List deployments; + /// List of deployments. + final List deployments; - DeploymentList({ - required this.total, - required this.deployments, - }); + DeploymentList({ + required this.total, + required this.deployments, + }); - factory DeploymentList.fromMap(Map map) { - return DeploymentList( - total: map['total'], - deployments: List.from( - map['deployments'].map((p) => Deployment.fromMap(p))), - ); - } + factory DeploymentList.fromMap(Map map) { + return DeploymentList( + total: map['total'], + deployments: List.from(map['deployments'].map((p) => Deployment.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/dev_key.dart b/lib/src/models/dev_key.dart index 06f90c5b..b743a031 100644 --- a/lib/src/models/dev_key.dart +++ b/lib/src/models/dev_key.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// DevKey class DevKey implements Model { - /// Key ID. - final String $id; + /// Key ID. + final String $id; - /// Key creation date in ISO 8601 format. - final String $createdAt; + /// Key creation date in ISO 8601 format. + final String $createdAt; - /// Key update date in ISO 8601 format. - final String $updatedAt; + /// Key update date in ISO 8601 format. + final String $updatedAt; - /// Key name. - final String name; + /// Key name. + final String name; - /// Key expiration date in ISO 8601 format. - final String expire; + /// Key expiration date in ISO 8601 format. + final String expire; - /// Secret key. - final String secret; + /// Secret key. + final String secret; - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; - /// List of SDK user agents that used this key. - final List sdks; + /// List of SDK user agents that used this key. + final List sdks; - DevKey({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.expire, - required this.secret, - required this.accessedAt, - required this.sdks, - }); + DevKey({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.secret, + required this.accessedAt, + required this.sdks, + }); - factory DevKey.fromMap(Map map) { - return DevKey( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - expire: map['expire'].toString(), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - sdks: List.from(map['sdks'] ?? []), - ); - } + factory DevKey.fromMap(Map map) { + return DevKey( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "expire": expire, - "secret": secret, - "accessedAt": accessedAt, - "sdks": sdks, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index be08d599..0d1fdeb0 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,66 +2,66 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document sequence ID. - final String $sequence; + /// Document sequence ID. + final String $sequence; - /// Collection ID. - final String $collectionId; + /// Collection ID. + final String $collectionId; - /// Database ID. - final String $databaseId; + /// Database ID. + final String $databaseId; - /// Document creation date in ISO 8601 format. - final String $createdAt; + /// Document creation date in ISO 8601 format. + final String $createdAt; - /// Document update date in ISO 8601 format. - final String $updatedAt; + /// Document update date in ISO 8601 format. + final String $updatedAt; - /// Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - final Map data; + final Map data; - Document({ - required this.$id, - required this.$sequence, - required this.$collectionId, - required this.$databaseId, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.data, - }); + Document({ + required this.$id, + required this.$sequence, + required this.$collectionId, + required this.$databaseId, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.data, + }); - factory Document.fromMap(Map map) { - return Document( - $id: map['\$id'].toString(), - $sequence: map['\$sequence'].toString(), - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map["data"] ?? map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$collectionId": $collectionId, + "\$databaseId": $databaseId, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/document_list.dart b/lib/src/models/document_list.dart index 76a07309..0e30844a 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,33 +2,32 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents that matched your query. - final int total; + /// Total number of documents that matched your query. + final int total; - /// List of documents. - final List documents; + /// List of documents. + final List documents; - DocumentList({ - required this.total, - required this.documents, - }); + DocumentList({ + required this.total, + required this.documents, + }); - factory DocumentList.fromMap(Map map) { - return DocumentList( - total: map['total'], - documents: - List.from(map['documents'].map((p) => Document.fromMap(p))), - ); - } + factory DocumentList.fromMap(Map map) { + return DocumentList( + total: map['total'], + documents: List.from(map['documents'].map((p) => Document.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "documents": documents.map((p) => p.toMap()).toList(), + }; + } - List convertTo(T Function(Map) fromJson) => - documents.map((d) => d.convertTo(fromJson)).toList(); + List convertTo(T Function(Map) fromJson) => + documents.map((d) => d.convertTo(fromJson)).toList(); } diff --git a/lib/src/models/email_template.dart b/lib/src/models/email_template.dart new file mode 100644 index 00000000..2aa13ed3 --- /dev/null +++ b/lib/src/models/email_template.dart @@ -0,0 +1,66 @@ +part of '../../models.dart'; + +/// EmailTemplate +class EmailTemplate implements Model { + /// Template type + final String templateId; + + /// Template locale + final String locale; + + /// Template message + final String message; + + /// Name of the sender + final String senderName; + + /// Email of the sender + final String senderEmail; + + /// Reply to email address + final String replyToEmail; + + /// Reply to name + final String replyToName; + + /// Email subject + final String subject; + + EmailTemplate({ + required this.templateId, + required this.locale, + required this.message, + required this.senderName, + required this.senderEmail, + required this.replyToEmail, + required this.replyToName, + required this.subject, + }); + + factory EmailTemplate.fromMap(Map map) { + return EmailTemplate( + templateId: map['templateId'].toString(), + locale: map['locale'].toString(), + message: map['message'].toString(), + senderName: map['senderName'].toString(), + senderEmail: map['senderEmail'].toString(), + replyToEmail: map['replyToEmail'].toString(), + replyToName: map['replyToName'].toString(), + subject: map['subject'].toString(), + ); + } + + @override + Map toMap() { + return { + "templateId": templateId, + "locale": locale, + "message": message, + "senderName": senderName, + "senderEmail": senderEmail, + "replyToEmail": replyToEmail, + "replyToName": replyToName, + "subject": subject, + }; + } +} diff --git a/lib/src/models/email_template_list.dart b/lib/src/models/email_template_list.dart new file mode 100644 index 00000000..fd583e50 --- /dev/null +++ b/lib/src/models/email_template_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Email Templates List +class EmailTemplateList implements Model { + /// Total number of templates that matched your query. + final int total; + + /// List of templates. + final List templates; + + EmailTemplateList({ + required this.total, + required this.templates, + }); + + factory EmailTemplateList.fromMap(Map map) { + return EmailTemplateList( + total: map['total'], + templates: List.from(map['templates'].map((p) => EmailTemplate.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "templates": templates.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/ephemeral_key.dart b/lib/src/models/ephemeral_key.dart new file mode 100644 index 00000000..95f0a3a4 --- /dev/null +++ b/lib/src/models/ephemeral_key.dart @@ -0,0 +1,72 @@ +part of '../../models.dart'; + +/// Ephemeral Key +class EphemeralKey implements Model { + /// Key ID. + final String $id; + + /// Key creation date in ISO 8601 format. + final String $createdAt; + + /// Key update date in ISO 8601 format. + final String $updatedAt; + + /// Key name. + final String name; + + /// Key expiration date in ISO 8601 format. + final String expire; + + /// Allowed permission scopes. + final List scopes; + + /// Secret key. + final String secret; + + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; + + /// List of SDK user agents that used this key. + final List sdks; + + EphemeralKey({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.scopes, + required this.secret, + required this.accessedAt, + required this.sdks, + }); + + factory EphemeralKey.fromMap(Map map) { + return EphemeralKey( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + scopes: List.from(map['scopes'] ?? []), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "scopes": scopes, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } +} diff --git a/lib/src/models/execution.dart b/lib/src/models/execution.dart index 3629e1d6..3e767ca3 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,129 +2,125 @@ part of '../../models.dart'; /// Execution class Execution implements Model { - /// Execution ID. - final String $id; - - /// Execution creation date in ISO 8601 format. - final String $createdAt; - - /// Execution update date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// Function's deployment ID used to create the execution. - final String deploymentId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final enums.ExecutionTrigger trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. - final enums.ExecutionStatus status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - final List requestHeaders; - - /// HTTP response status code. - final int responseStatusCode; - - /// HTTP response body. This will return empty unless execution is created as synchronous. - final String responseBody; - - /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - final List responseHeaders; - - /// Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - final String logs; - - /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - final String errors; - - /// Resource(function/site) execution duration in seconds. - final double duration; - - /// The scheduled time for execution. If left empty, execution will be queued immediately. - final String? scheduledAt; - - Execution({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.functionId, - required this.deploymentId, - required this.trigger, - required this.status, - required this.requestMethod, - required this.requestPath, - required this.requestHeaders, - required this.responseStatusCode, - required this.responseBody, - required this.responseHeaders, - required this.logs, - required this.errors, - required this.duration, - this.scheduledAt, - }); - - factory Execution.fromMap(Map map) { - return Execution( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - functionId: map['functionId'].toString(), - deploymentId: map['deploymentId'].toString(), - trigger: enums.ExecutionTrigger.values - .firstWhere((e) => e.value == map['trigger']), - status: enums.ExecutionStatus.values - .firstWhere((e) => e.value == map['status']), - requestMethod: map['requestMethod'].toString(), - requestPath: map['requestPath'].toString(), - requestHeaders: List.from( - map['requestHeaders'].map((p) => Headers.fromMap(p))), - responseStatusCode: map['responseStatusCode'], - responseBody: map['responseBody'].toString(), - responseHeaders: List.from( - map['responseHeaders'].map((p) => Headers.fromMap(p))), - logs: map['logs'].toString(), - errors: map['errors'].toString(), - duration: map['duration'].toDouble(), - scheduledAt: map['scheduledAt']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger.value, - "status": status.value, - "requestMethod": requestMethod, - "requestPath": requestPath, - "requestHeaders": requestHeaders.map((p) => p.toMap()).toList(), - "responseStatusCode": responseStatusCode, - "responseBody": responseBody, - "responseHeaders": responseHeaders.map((p) => p.toMap()).toList(), - "logs": logs, - "errors": errors, - "duration": duration, - "scheduledAt": scheduledAt, - }; - } + /// Execution ID. + final String $id; + + /// Execution creation date in ISO 8601 format. + final String $createdAt; + + /// Execution update date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// Function's deployment ID used to create the execution. + final String deploymentId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final enums.ExecutionTrigger trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + final enums.ExecutionStatus status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + final List requestHeaders; + + /// HTTP response status code. + final int responseStatusCode; + + /// HTTP response body. This will return empty unless execution is created as synchronous. + final String responseBody; + + /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + final List responseHeaders; + + /// Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + final String logs; + + /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + final String errors; + + /// Resource(function/site) execution duration in seconds. + final double duration; + + /// The scheduled time for execution. If left empty, execution will be queued immediately. + final String? scheduledAt; + + Execution({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.functionId, + required this.deploymentId, + required this.trigger, + required this.status, + required this.requestMethod, + required this.requestPath, + required this.requestHeaders, + required this.responseStatusCode, + required this.responseBody, + required this.responseHeaders, + required this.logs, + required this.errors, + required this.duration, + this.scheduledAt, + }); + + factory Execution.fromMap(Map map) { + return Execution( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + functionId: map['functionId'].toString(), + deploymentId: map['deploymentId'].toString(), + trigger: enums.ExecutionTrigger.values.firstWhere((e) => e.value == map['trigger']), + status: enums.ExecutionStatus.values.firstWhere((e) => e.value == map['status']), + requestMethod: map['requestMethod'].toString(), + requestPath: map['requestPath'].toString(), + requestHeaders: List.from(map['requestHeaders'].map((p) => Headers.fromMap(p))), + responseStatusCode: map['responseStatusCode'], + responseBody: map['responseBody'].toString(), + responseHeaders: List.from(map['responseHeaders'].map((p) => Headers.fromMap(p))), + logs: map['logs'].toString(), + errors: map['errors'].toString(), + duration: map['duration'].toDouble(), + scheduledAt: map['scheduledAt']?.toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger.value, + "status": status.value, + "requestMethod": requestMethod, + "requestPath": requestPath, + "requestHeaders": requestHeaders.map((p) => p.toMap()).toList(), + "responseStatusCode": responseStatusCode, + "responseBody": responseBody, + "responseHeaders": responseHeaders.map((p) => p.toMap()).toList(), + "logs": logs, + "errors": errors, + "duration": duration, + "scheduledAt": scheduledAt, + }; + } } diff --git a/lib/src/models/execution_list.dart b/lib/src/models/execution_list.dart index 63c2ad7e..45b60682 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions that matched your query. - final int total; + /// Total number of executions that matched your query. + final int total; - /// List of executions. - final List executions; + /// List of executions. + final List executions; - ExecutionList({ - required this.total, - required this.executions, - }); + ExecutionList({ + required this.total, + required this.executions, + }); - factory ExecutionList.fromMap(Map map) { - return ExecutionList( - total: map['total'], - executions: List.from( - map['executions'].map((p) => Execution.fromMap(p))), - ); - } + factory ExecutionList.fromMap(Map map) { + return ExecutionList( + total: map['total'], + executions: List.from(map['executions'].map((p) => Execution.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "executions": executions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/file.dart b/lib/src/models/file.dart index d17a8aac..0315d4a7 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,95 +2,95 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; - - /// Bucket ID. - final String bucketId; - - /// File creation date in ISO 8601 format. - final String $createdAt; - - /// File update date in ISO 8601 format. - final String $updatedAt; - - /// File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; - - /// File name. - final String name; - - /// File MD5 signature. - final String signature; - - /// File mime type. - final String mimeType; - - /// File original size in bytes. - final int sizeOriginal; - - /// Total number of chunks available - final int chunksTotal; - - /// Total number of chunks uploaded - final int chunksUploaded; - - /// Whether file contents are encrypted at rest. - final bool encryption; - - /// Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - final String compression; - - File({ - required this.$id, - required this.bucketId, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.name, - required this.signature, - required this.mimeType, - required this.sizeOriginal, - required this.chunksTotal, - required this.chunksUploaded, - required this.encryption, - required this.compression, - }); - - factory File.fromMap(Map map) { - return File( - $id: map['\$id'].toString(), - bucketId: map['bucketId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - name: map['name'].toString(), - signature: map['signature'].toString(), - mimeType: map['mimeType'].toString(), - sizeOriginal: map['sizeOriginal'], - chunksTotal: map['chunksTotal'], - chunksUploaded: map['chunksUploaded'], - encryption: map['encryption'], - compression: map['compression'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "bucketId": bucketId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "name": name, - "signature": signature, - "mimeType": mimeType, - "sizeOriginal": sizeOriginal, - "chunksTotal": chunksTotal, - "chunksUploaded": chunksUploaded, - "encryption": encryption, - "compression": compression, - }; - } + /// File ID. + final String $id; + + /// Bucket ID. + final String bucketId; + + /// File creation date in ISO 8601 format. + final String $createdAt; + + /// File update date in ISO 8601 format. + final String $updatedAt; + + /// File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// File name. + final String name; + + /// File MD5 signature. + final String signature; + + /// File mime type. + final String mimeType; + + /// File original size in bytes. + final int sizeOriginal; + + /// Total number of chunks available + final int chunksTotal; + + /// Total number of chunks uploaded + final int chunksUploaded; + + /// Whether file contents are encrypted at rest. + final bool encryption; + + /// Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + final String compression; + + File({ + required this.$id, + required this.bucketId, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.name, + required this.signature, + required this.mimeType, + required this.sizeOriginal, + required this.chunksTotal, + required this.chunksUploaded, + required this.encryption, + required this.compression, + }); + + factory File.fromMap(Map map) { + return File( + $id: map['\$id'].toString(), + bucketId: map['bucketId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + name: map['name'].toString(), + signature: map['signature'].toString(), + mimeType: map['mimeType'].toString(), + sizeOriginal: map['sizeOriginal'], + chunksTotal: map['chunksTotal'], + chunksUploaded: map['chunksUploaded'], + encryption: map['encryption'], + compression: map['compression'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "bucketId": bucketId, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "name": name, + "signature": signature, + "mimeType": mimeType, + "sizeOriginal": sizeOriginal, + "chunksTotal": chunksTotal, + "chunksUploaded": chunksUploaded, + "encryption": encryption, + "compression": compression, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 1157554a..84c54b2e 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files that matched your query. - final int total; + /// Total number of files that matched your query. + final int total; - /// List of files. - final List files; + /// List of files. + final List files; - FileList({ - required this.total, - required this.files, - }); + FileList({ + required this.total, + required this.files, + }); - factory FileList.fromMap(Map map) { - return FileList( - total: map['total'], - files: List.from(map['files'].map((p) => File.fromMap(p))), - ); - } + factory FileList.fromMap(Map map) { + return FileList( + total: map['total'], + files: List.from(map['files'].map((p) => File.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "files": files.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/framework.dart b/lib/src/models/framework.dart index b8004b02..98e9b781 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,48 +2,47 @@ part of '../../models.dart'; /// Framework class Framework implements Model { - /// Framework key. - final String key; - - /// Framework Name. - final String name; - - /// Default runtime version. - final String buildRuntime; - - /// List of supported runtime versions. - final List runtimes; - - /// List of supported adapters. - final List adapters; - - Framework({ - required this.key, - required this.name, - required this.buildRuntime, - required this.runtimes, - required this.adapters, - }); - - factory Framework.fromMap(Map map) { - return Framework( - key: map['key'].toString(), - name: map['name'].toString(), - buildRuntime: map['buildRuntime'].toString(), - runtimes: List.from(map['runtimes'] ?? []), - adapters: List.from( - map['adapters'].map((p) => FrameworkAdapter.fromMap(p))), - ); - } - - @override - Map toMap() { - return { - "key": key, - "name": name, - "buildRuntime": buildRuntime, - "runtimes": runtimes, - "adapters": adapters.map((p) => p.toMap()).toList(), - }; - } + /// Framework key. + final String key; + + /// Framework Name. + final String name; + + /// Default runtime version. + final String buildRuntime; + + /// List of supported runtime versions. + final List runtimes; + + /// List of supported adapters. + final List adapters; + + Framework({ + required this.key, + required this.name, + required this.buildRuntime, + required this.runtimes, + required this.adapters, + }); + + factory Framework.fromMap(Map map) { + return Framework( + key: map['key'].toString(), + name: map['name'].toString(), + buildRuntime: map['buildRuntime'].toString(), + runtimes: List.from(map['runtimes'] ?? []), + adapters: List.from(map['adapters'].map((p) => FrameworkAdapter.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "key": key, + "name": name, + "buildRuntime": buildRuntime, + "runtimes": runtimes, + "adapters": adapters.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/framework_adapter.dart b/lib/src/models/framework_adapter.dart index f2bb826d..3531430e 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// Framework Adapter class FrameworkAdapter implements Model { - /// Adapter key. - final String key; - - /// Default command to download dependencies. - final String installCommand; - - /// Default command to build site into output directory. - final String buildCommand; - - /// Default output directory of build. - final String outputDirectory; - - /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - final String fallbackFile; - - FrameworkAdapter({ - required this.key, - required this.installCommand, - required this.buildCommand, - required this.outputDirectory, - required this.fallbackFile, - }); - - factory FrameworkAdapter.fromMap(Map map) { - return FrameworkAdapter( - key: map['key'].toString(), - installCommand: map['installCommand'].toString(), - buildCommand: map['buildCommand'].toString(), - outputDirectory: map['outputDirectory'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - @override - Map toMap() { - return { - "key": key, - "installCommand": installCommand, - "buildCommand": buildCommand, - "outputDirectory": outputDirectory, - "fallbackFile": fallbackFile, - }; - } + /// Adapter key. + final String key; + + /// Default command to download dependencies. + final String installCommand; + + /// Default command to build site into output directory. + final String buildCommand; + + /// Default output directory of build. + final String outputDirectory; + + /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + final String fallbackFile; + + FrameworkAdapter({ + required this.key, + required this.installCommand, + required this.buildCommand, + required this.outputDirectory, + required this.fallbackFile, + }); + + factory FrameworkAdapter.fromMap(Map map) { + return FrameworkAdapter( + key: map['key'].toString(), + installCommand: map['installCommand'].toString(), + buildCommand: map['buildCommand'].toString(), + outputDirectory: map['outputDirectory'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + @override + Map toMap() { + return { + "key": key, + "installCommand": installCommand, + "buildCommand": buildCommand, + "outputDirectory": outputDirectory, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/framework_list.dart b/lib/src/models/framework_list.dart index 2c7f35b0..92cdc520 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks that matched your query. - final int total; + /// Total number of frameworks that matched your query. + final int total; - /// List of frameworks. - final List frameworks; + /// List of frameworks. + final List frameworks; - FrameworkList({ - required this.total, - required this.frameworks, - }); + FrameworkList({ + required this.total, + required this.frameworks, + }); - factory FrameworkList.fromMap(Map map) { - return FrameworkList( - total: map['total'], - frameworks: List.from( - map['frameworks'].map((p) => Framework.fromMap(p))), - ); - } + factory FrameworkList.fromMap(Map map) { + return FrameworkList( + total: map['total'], + frameworks: List.from(map['frameworks'].map((p) => Framework.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "frameworks": frameworks.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/function.dart b/lib/src/models/function.dart index ddf8accb..e324613c 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,197 +2,197 @@ part of '../../models.dart'; /// Function class Func implements Model { - /// Function ID. - final String $id; + /// Function ID. + final String $id; - /// Function creation date in ISO 8601 format. - final String $createdAt; + /// Function creation date in ISO 8601 format. + final String $createdAt; - /// Function update date in ISO 8601 format. - final String $updatedAt; + /// Function update date in ISO 8601 format. + final String $updatedAt; - /// Execution permissions. - final List execute; + /// Execution permissions. + final List execute; - /// Function name. - final String name; + /// Function name. + final String name; - /// Function enabled. - final bool enabled; + /// Function enabled. + final bool enabled; - /// Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. - final bool live; + /// Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. + final bool live; - /// When disabled, executions will exclude logs and errors, and will be slightly faster. - final bool logging; + /// When disabled, executions will exclude logs and errors, and will be slightly faster. + final bool logging; - /// Function execution and build runtime. - final String runtime; + /// Function execution and build runtime. + final String runtime; - /// How many days to keep the non-active deployments before they will be automatically deleted. - final int deploymentRetention; - - /// Function's active deployment ID. - final String deploymentId; - - /// Active deployment creation date in ISO 8601 format. - final String deploymentCreatedAt; - - /// Function's latest deployment ID. - final String latestDeploymentId; - - /// Latest deployment creation date in ISO 8601 format. - final String latestDeploymentCreatedAt; - - /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - final String latestDeploymentStatus; - - /// Allowed permission scopes. - final List scopes; - - /// Function variables. - final List vars; - - /// Function trigger events. - final List events; - - /// Function execution schedule in CRON format. - final String schedule; - - /// Function execution timeout in seconds. - final int timeout; - - /// The entrypoint file used to execute the deployment. - final String entrypoint; - - /// The build command used to build the deployment. - final String commands; - - /// Version of Open Runtimes used for the function. - final String version; - - /// Function VCS (Version Control System) installation id. - final String installationId; - - /// VCS (Version Control System) Repository ID - final String providerRepositoryId; - - /// VCS (Version Control System) branch name - final String providerBranch; - - /// Path to function in VCS (Version Control System) repository - final String providerRootDirectory; - - /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - final bool providerSilentMode; - - /// Machine specification for deployment builds. - final String buildSpecification; - - /// Machine specification for executions. - final String runtimeSpecification; - - Func({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.execute, - required this.name, - required this.enabled, - required this.live, - required this.logging, - required this.runtime, - required this.deploymentRetention, - required this.deploymentId, - required this.deploymentCreatedAt, - required this.latestDeploymentId, - required this.latestDeploymentCreatedAt, - required this.latestDeploymentStatus, - required this.scopes, - required this.vars, - required this.events, - required this.schedule, - required this.timeout, - required this.entrypoint, - required this.commands, - required this.version, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.buildSpecification, - required this.runtimeSpecification, - }); - - factory Func.fromMap(Map map) { - return Func( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - execute: List.from(map['execute'] ?? []), - name: map['name'].toString(), - enabled: map['enabled'], - live: map['live'], - logging: map['logging'], - runtime: map['runtime'].toString(), - deploymentRetention: map['deploymentRetention'], - deploymentId: map['deploymentId'].toString(), - deploymentCreatedAt: map['deploymentCreatedAt'].toString(), - latestDeploymentId: map['latestDeploymentId'].toString(), - latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), - latestDeploymentStatus: map['latestDeploymentStatus'].toString(), - scopes: List.from(map['scopes'] ?? []), - vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), - events: List.from(map['events'] ?? []), - schedule: map['schedule'].toString(), - timeout: map['timeout'], - entrypoint: map['entrypoint'].toString(), - commands: map['commands'].toString(), - version: map['version'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - buildSpecification: map['buildSpecification'].toString(), - runtimeSpecification: map['runtimeSpecification'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "deploymentRetention": deploymentRetention, - "deploymentId": deploymentId, - "deploymentCreatedAt": deploymentCreatedAt, - "latestDeploymentId": latestDeploymentId, - "latestDeploymentCreatedAt": latestDeploymentCreatedAt, - "latestDeploymentStatus": latestDeploymentStatus, - "scopes": scopes, - "vars": vars.map((p) => p.toMap()).toList(), - "events": events, - "schedule": schedule, - "timeout": timeout, - "entrypoint": entrypoint, - "commands": commands, - "version": version, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "buildSpecification": buildSpecification, - "runtimeSpecification": runtimeSpecification, - }; - } + /// How many days to keep the non-active deployments before they will be automatically deleted. + final int deploymentRetention; + + /// Function's active deployment ID. + final String deploymentId; + + /// Active deployment creation date in ISO 8601 format. + final String deploymentCreatedAt; + + /// Function's latest deployment ID. + final String latestDeploymentId; + + /// Latest deployment creation date in ISO 8601 format. + final String latestDeploymentCreatedAt; + + /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + final String latestDeploymentStatus; + + /// Allowed permission scopes. + final List scopes; + + /// Function variables. + final List vars; + + /// Function trigger events. + final List events; + + /// Function execution schedule in CRON format. + final String schedule; + + /// Function execution timeout in seconds. + final int timeout; + + /// The entrypoint file used to execute the deployment. + final String entrypoint; + + /// The build command used to build the deployment. + final String commands; + + /// Version of Open Runtimes used for the function. + final String version; + + /// Function VCS (Version Control System) installation id. + final String installationId; + + /// VCS (Version Control System) Repository ID + final String providerRepositoryId; + + /// VCS (Version Control System) branch name + final String providerBranch; + + /// Path to function in VCS (Version Control System) repository + final String providerRootDirectory; + + /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + final bool providerSilentMode; + + /// Machine specification for deployment builds. + final String buildSpecification; + + /// Machine specification for executions. + final String runtimeSpecification; + + Func({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.execute, + required this.name, + required this.enabled, + required this.live, + required this.logging, + required this.runtime, + required this.deploymentRetention, + required this.deploymentId, + required this.deploymentCreatedAt, + required this.latestDeploymentId, + required this.latestDeploymentCreatedAt, + required this.latestDeploymentStatus, + required this.scopes, + required this.vars, + required this.events, + required this.schedule, + required this.timeout, + required this.entrypoint, + required this.commands, + required this.version, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.buildSpecification, + required this.runtimeSpecification, + }); + + factory Func.fromMap(Map map) { + return Func( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + execute: List.from(map['execute'] ?? []), + name: map['name'].toString(), + enabled: map['enabled'], + live: map['live'], + logging: map['logging'], + runtime: map['runtime'].toString(), + deploymentRetention: map['deploymentRetention'], + deploymentId: map['deploymentId'].toString(), + deploymentCreatedAt: map['deploymentCreatedAt'].toString(), + latestDeploymentId: map['latestDeploymentId'].toString(), + latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), + latestDeploymentStatus: map['latestDeploymentStatus'].toString(), + scopes: List.from(map['scopes'] ?? []), + vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), + events: List.from(map['events'] ?? []), + schedule: map['schedule'].toString(), + timeout: map['timeout'], + entrypoint: map['entrypoint'].toString(), + commands: map['commands'].toString(), + version: map['version'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + buildSpecification: map['buildSpecification'].toString(), + runtimeSpecification: map['runtimeSpecification'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "deploymentRetention": deploymentRetention, + "deploymentId": deploymentId, + "deploymentCreatedAt": deploymentCreatedAt, + "latestDeploymentId": latestDeploymentId, + "latestDeploymentCreatedAt": latestDeploymentCreatedAt, + "latestDeploymentStatus": latestDeploymentStatus, + "scopes": scopes, + "vars": vars.map((p) => p.toMap()).toList(), + "events": events, + "schedule": schedule, + "timeout": timeout, + "entrypoint": entrypoint, + "commands": commands, + "version": version, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "buildSpecification": buildSpecification, + "runtimeSpecification": runtimeSpecification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 4e41664a..995c70ac 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions that matched your query. - final int total; + /// Total number of functions that matched your query. + final int total; - /// List of functions. - final List functions; + /// List of functions. + final List functions; - FunctionList({ - required this.total, - required this.functions, - }); + FunctionList({ + required this.total, + required this.functions, + }); - factory FunctionList.fromMap(Map map) { - return FunctionList( - total: map['total'], - functions: List.from(map['functions'].map((p) => Func.fromMap(p))), - ); - } + factory FunctionList.fromMap(Map map) { + return FunctionList( + total: map['total'], + functions: List.from(map['functions'].map((p) => Func.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "functions": functions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/headers.dart b/lib/src/models/headers.dart index fa054420..bbccf88a 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Headers class Headers implements Model { - /// Header name. - final String name; + /// Header name. + final String name; - /// Header value. - final String value; + /// Header value. + final String value; - Headers({ - required this.name, - required this.value, - }); + Headers({ + required this.name, + required this.value, + }); - factory Headers.fromMap(Map map) { - return Headers( - name: map['name'].toString(), - value: map['value'].toString(), - ); - } + factory Headers.fromMap(Map map) { + return Headers( + name: map['name'].toString(), + value: map['value'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "value": value, - }; - } + @override + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 4260f8e5..1e041099 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values are: `disabled`, `offline`, `online` - final enums.HealthAntivirusStatus status; + /// Antivirus status. Possible values are: `disabled`, `offline`, `online` + final enums.HealthAntivirusStatus status; - HealthAntivirus({ - required this.version, - required this.status, - }); + HealthAntivirus({ + required this.version, + required this.status, + }); - factory HealthAntivirus.fromMap(Map map) { - return HealthAntivirus( - version: map['version'].toString(), - status: enums.HealthAntivirusStatus.values - .firstWhere((e) => e.value == map['status']), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: enums.HealthAntivirusStatus.values.firstWhere((e) => e.value == map['status']), + ); + } - @override - Map toMap() { - return { - "version": version, - "status": status.value, - }; - } + @override + Map toMap() { + return { + "version": version, + "status": status.value, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index c20e9146..eb1ea068 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Health Certificate class HealthCertificate implements Model { - /// Certificate name - final String name; - - /// Subject SN - final String subjectSN; - - /// Issuer organisation - final String issuerOrganisation; - - /// Valid from - final String validFrom; - - /// Valid to - final String validTo; - - /// Signature type SN - final String signatureTypeSN; - - HealthCertificate({ - required this.name, - required this.subjectSN, - required this.issuerOrganisation, - required this.validFrom, - required this.validTo, - required this.signatureTypeSN, - }); - - factory HealthCertificate.fromMap(Map map) { - return HealthCertificate( - name: map['name'].toString(), - subjectSN: map['subjectSN'].toString(), - issuerOrganisation: map['issuerOrganisation'].toString(), - validFrom: map['validFrom'].toString(), - validTo: map['validTo'].toString(), - signatureTypeSN: map['signatureTypeSN'].toString(), - ); - } - - @override - Map toMap() { - return { - "name": name, - "subjectSN": subjectSN, - "issuerOrganisation": issuerOrganisation, - "validFrom": validFrom, - "validTo": validTo, - "signatureTypeSN": signatureTypeSN, - }; - } + /// Certificate name + final String name; + + /// Subject SN + final String subjectSN; + + /// Issuer organisation + final String issuerOrganisation; + + /// Valid from + final String validFrom; + + /// Valid to + final String validTo; + + /// Signature type SN + final String signatureTypeSN; + + HealthCertificate({ + required this.name, + required this.subjectSN, + required this.issuerOrganisation, + required this.validFrom, + required this.validTo, + required this.signatureTypeSN, + }); + + factory HealthCertificate.fromMap(Map map) { + return HealthCertificate( + name: map['name'].toString(), + subjectSN: map['subjectSN'].toString(), + issuerOrganisation: map['issuerOrganisation'].toString(), + validFrom: map['validFrom'].toString(), + validTo: map['validTo'].toString(), + signatureTypeSN: map['signatureTypeSN'].toString(), + ); + } + + @override + Map toMap() { + return { + "name": name, + "subjectSN": subjectSN, + "issuerOrganisation": issuerOrganisation, + "validFrom": validFrom, + "validTo": validTo, + "signatureTypeSN": signatureTypeSN, + }; + } } diff --git a/lib/src/models/health_queue.dart b/lib/src/models/health_queue.dart index 8f39b667..3c52f78f 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// Health Queue class HealthQueue implements Model { - /// Amount of actions in the queue. - final int size; + /// Amount of actions in the queue. + final int size; - HealthQueue({ - required this.size, - }); + HealthQueue({ + required this.size, + }); - factory HealthQueue.fromMap(Map map) { - return HealthQueue( - size: map['size'], - ); - } + factory HealthQueue.fromMap(Map map) { + return HealthQueue( + size: map['size'], + ); + } - @override - Map toMap() { - return { - "size": size, - }; - } + @override + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index f1f073ea..8c16480c 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,36 +2,35 @@ part of '../../models.dart'; /// Health Status class HealthStatus implements Model { - /// Name of the service. - final String name; + /// Name of the service. + final String name; - /// Duration in milliseconds how long the health check took. - final int ping; + /// Duration in milliseconds how long the health check took. + final int ping; - /// Service status. Possible values are: `pass`, `fail` - final enums.HealthCheckStatus status; + /// Service status. Possible values are: `pass`, `fail` + final enums.HealthCheckStatus status; - HealthStatus({ - required this.name, - required this.ping, - required this.status, - }); + HealthStatus({ + required this.name, + required this.ping, + required this.status, + }); - factory HealthStatus.fromMap(Map map) { - return HealthStatus( - name: map['name'].toString(), - ping: map['ping'], - status: enums.HealthCheckStatus.values - .firstWhere((e) => e.value == map['status']), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: enums.HealthCheckStatus.values.firstWhere((e) => e.value == map['status']), + ); + } - @override - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status.value, - }; - } + @override + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status.value, + }; + } } diff --git a/lib/src/models/health_status_list.dart b/lib/src/models/health_status_list.dart index 54d8f149..0d09e6f7 100644 --- a/lib/src/models/health_status_list.dart +++ b/lib/src/models/health_status_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Status List class HealthStatusList implements Model { - /// Total number of statuses that matched your query. - final int total; + /// Total number of statuses that matched your query. + final int total; - /// List of statuses. - final List statuses; + /// List of statuses. + final List statuses; - HealthStatusList({ - required this.total, - required this.statuses, - }); + HealthStatusList({ + required this.total, + required this.statuses, + }); - factory HealthStatusList.fromMap(Map map) { - return HealthStatusList( - total: map['total'], - statuses: List.from( - map['statuses'].map((p) => HealthStatus.fromMap(p))), - ); - } + factory HealthStatusList.fromMap(Map map) { + return HealthStatusList( + total: map['total'], + statuses: List.from(map['statuses'].map((p) => HealthStatus.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "statuses": statuses.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "statuses": statuses.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 6ee89297..80d3cad1 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,35 +2,35 @@ part of '../../models.dart'; /// Health Time class HealthTime implements Model { - /// Current unix timestamp on trustful remote server. - final int remoteTime; + /// Current unix timestamp on trustful remote server. + final int remoteTime; - /// Current unix timestamp of local server where Appwrite runs. - final int localTime; + /// Current unix timestamp of local server where Appwrite runs. + final int localTime; - /// Difference of unix remote and local timestamps in milliseconds. - final int diff; + /// Difference of unix remote and local timestamps in milliseconds. + final int diff; - HealthTime({ - required this.remoteTime, - required this.localTime, - required this.diff, - }); + HealthTime({ + required this.remoteTime, + required this.localTime, + required this.diff, + }); - factory HealthTime.fromMap(Map map) { - return HealthTime( - remoteTime: map['remoteTime'], - localTime: map['localTime'], - diff: map['diff'], - ); - } + factory HealthTime.fromMap(Map map) { + return HealthTime( + remoteTime: map['remoteTime'], + localTime: map['localTime'], + diff: map['diff'], + ); + } - @override - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + @override + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index cc659043..7e90020c 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,77 +2,77 @@ part of '../../models.dart'; /// Identity class Identity implements Model { - /// Identity ID. - final String $id; + /// Identity ID. + final String $id; - /// Identity creation date in ISO 8601 format. - final String $createdAt; + /// Identity creation date in ISO 8601 format. + final String $createdAt; - /// Identity update date in ISO 8601 format. - final String $updatedAt; + /// Identity update date in ISO 8601 format. + final String $updatedAt; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Identity Provider. - final String provider; + /// Identity Provider. + final String provider; - /// ID of the User in the Identity Provider. - final String providerUid; + /// ID of the User in the Identity Provider. + final String providerUid; - /// Email of the User in the Identity Provider. - final String providerEmail; + /// Email of the User in the Identity Provider. + final String providerEmail; - /// Identity Provider Access Token. - final String providerAccessToken; + /// Identity Provider Access Token. + final String providerAccessToken; - /// The date of when the access token expires in ISO 8601 format. - final String providerAccessTokenExpiry; + /// The date of when the access token expires in ISO 8601 format. + final String providerAccessTokenExpiry; - /// Identity Provider Refresh Token. - final String providerRefreshToken; + /// Identity Provider Refresh Token. + final String providerRefreshToken; - Identity({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.userId, - required this.provider, - required this.providerUid, - required this.providerEmail, - required this.providerAccessToken, - required this.providerAccessTokenExpiry, - required this.providerRefreshToken, - }); + Identity({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.userId, + required this.provider, + required this.providerUid, + required this.providerEmail, + required this.providerAccessToken, + required this.providerAccessTokenExpiry, + required this.providerRefreshToken, + }); - factory Identity.fromMap(Map map) { - return Identity( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - userId: map['userId'].toString(), - provider: map['provider'].toString(), - providerUid: map['providerUid'].toString(), - providerEmail: map['providerEmail'].toString(), - providerAccessToken: map['providerAccessToken'].toString(), - providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), - providerRefreshToken: map['providerRefreshToken'].toString(), - ); - } + factory Identity.fromMap(Map map) { + return Identity( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + userId: map['userId'].toString(), + provider: map['provider'].toString(), + providerUid: map['providerUid'].toString(), + providerEmail: map['providerEmail'].toString(), + providerAccessToken: map['providerAccessToken'].toString(), + providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), + providerRefreshToken: map['providerRefreshToken'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "userId": userId, + "provider": provider, + "providerUid": providerUid, + "providerEmail": providerEmail, + "providerAccessToken": providerAccessToken, + "providerAccessTokenExpiry": providerAccessTokenExpiry, + "providerRefreshToken": providerRefreshToken, + }; + } } diff --git a/lib/src/models/identity_list.dart b/lib/src/models/identity_list.dart index a5d39ea0..d9cc09a2 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities that matched your query. - final int total; + /// Total number of identities that matched your query. + final int total; - /// List of identities. - final List identities; + /// List of identities. + final List identities; - IdentityList({ - required this.total, - required this.identities, - }); + IdentityList({ + required this.total, + required this.identities, + }); - factory IdentityList.fromMap(Map map) { - return IdentityList( - total: map['total'], - identities: List.from( - map['identities'].map((p) => Identity.fromMap(p))), - ); - } + factory IdentityList.fromMap(Map map) { + return IdentityList( + total: map['total'], + identities: List.from(map['identities'].map((p) => Identity.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "identities": identities.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/index.dart b/lib/src/models/index.dart index b3e40a07..dc632069 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,78 +2,77 @@ part of '../../models.dart'; /// Index class Index implements Model { - /// Index ID. - final String $id; + /// Index ID. + final String $id; - /// Index creation date in ISO 8601 format. - final String $createdAt; + /// Index creation date in ISO 8601 format. + final String $createdAt; - /// Index update date in ISO 8601 format. - final String $updatedAt; + /// Index update date in ISO 8601 format. + final String $updatedAt; - /// Index key. - final String key; + /// Index key. + final String key; - /// Index type. - final String type; + /// Index type. + final String type; - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.IndexStatus status; + /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.IndexStatus status; - /// Error message. Displays error generated on failure of creating or deleting an index. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an index. + final String error; - /// Index attributes. - final List attributes; + /// Index attributes. + final List attributes; - /// Index attributes length. - final List lengths; + /// Index attributes length. + final List lengths; - /// Index orders. - final List? orders; + /// Index orders. + final List? orders; - Index({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.key, - required this.type, - required this.status, - required this.error, - required this.attributes, - required this.lengths, - this.orders, - }); + Index({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.key, + required this.type, + required this.status, + required this.error, + required this.attributes, + required this.lengths, + this.orders, + }); - factory Index.fromMap(Map map) { - return Index( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - key: map['key'].toString(), - type: map['type'].toString(), - status: - enums.IndexStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - attributes: List.from(map['attributes'] ?? []), - lengths: List.from(map['lengths'] ?? []), - orders: List.from(map['orders'] ?? []), - ); - } + factory Index.fromMap(Map map) { + return Index( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.IndexStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status.value, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status.value, + "error": error, + "attributes": attributes, + "lengths": lengths, + "orders": orders, + }; + } } diff --git a/lib/src/models/index_list.dart b/lib/src/models/index_list.dart index b92c5f4b..8b91c431 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes that matched your query. - final int total; + /// Total number of indexes that matched your query. + final int total; - /// List of indexes. - final List indexes; + /// List of indexes. + final List indexes; - IndexList({ - required this.total, - required this.indexes, - }); + IndexList({ + required this.total, + required this.indexes, + }); - factory IndexList.fromMap(Map map) { - return IndexList( - total: map['total'], - indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), - ); - } + factory IndexList.fromMap(Map map) { + return IndexList( + total: map['total'], + indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "indexes": indexes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/jwt.dart b/lib/src/models/jwt.dart index cda66c70..2000acb6 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// JWT class Jwt implements Model { - /// JWT encoded string. - final String jwt; + /// JWT encoded string. + final String jwt; - Jwt({ - required this.jwt, - }); + Jwt({ + required this.jwt, + }); - factory Jwt.fromMap(Map map) { - return Jwt( - jwt: map['jwt'].toString(), - ); - } + factory Jwt.fromMap(Map map) { + return Jwt( + jwt: map['jwt'].toString(), + ); + } - @override - Map toMap() { - return { - "jwt": jwt, - }; - } + @override + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/key.dart b/lib/src/models/key.dart index 15946090..f0c50e58 100644 --- a/lib/src/models/key.dart +++ b/lib/src/models/key.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Key class Key implements Model { - /// Key ID. - final String $id; + /// Key ID. + final String $id; - /// Key creation date in ISO 8601 format. - final String $createdAt; + /// Key creation date in ISO 8601 format. + final String $createdAt; - /// Key update date in ISO 8601 format. - final String $updatedAt; + /// Key update date in ISO 8601 format. + final String $updatedAt; - /// Key name. - final String name; + /// Key name. + final String name; - /// Key expiration date in ISO 8601 format. - final String expire; + /// Key expiration date in ISO 8601 format. + final String expire; - /// Allowed permission scopes. - final List scopes; + /// Allowed permission scopes. + final List scopes; - /// Secret key. - final String secret; + /// Secret key. + final String secret; - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; - /// List of SDK user agents that used this key. - final List sdks; + /// List of SDK user agents that used this key. + final List sdks; - Key({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.expire, - required this.scopes, - required this.secret, - required this.accessedAt, - required this.sdks, - }); + Key({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.scopes, + required this.secret, + required this.accessedAt, + required this.sdks, + }); - factory Key.fromMap(Map map) { - return Key( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - expire: map['expire'].toString(), - scopes: List.from(map['scopes'] ?? []), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - sdks: List.from(map['sdks'] ?? []), - ); - } + factory Key.fromMap(Map map) { + return Key( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + scopes: List.from(map['scopes'] ?? []), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "expire": expire, - "scopes": scopes, - "secret": secret, - "accessedAt": accessedAt, - "sdks": sdks, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "scopes": scopes, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } } diff --git a/lib/src/models/key_list.dart b/lib/src/models/key_list.dart index 127a6cd7..e5e99a7f 100644 --- a/lib/src/models/key_list.dart +++ b/lib/src/models/key_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// API Keys List class KeyList implements Model { - /// Total number of keys that matched your query. - final int total; + /// Total number of keys that matched your query. + final int total; - /// List of keys. - final List keys; + /// List of keys. + final List keys; - KeyList({ - required this.total, - required this.keys, - }); + KeyList({ + required this.total, + required this.keys, + }); - factory KeyList.fromMap(Map map) { - return KeyList( - total: map['total'], - keys: List.from(map['keys'].map((p) => Key.fromMap(p))), - ); - } + factory KeyList.fromMap(Map map) { + return KeyList( + total: map['total'], + keys: List.from(map['keys'].map((p) => Key.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "keys": keys.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "keys": keys.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 87dc3606..1422d065 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,35 +2,35 @@ part of '../../models.dart'; /// Language class Language implements Model { - /// Language name. - final String name; + /// Language name. + final String name; - /// Language two-character ISO 639-1 codes. - final String code; + /// Language two-character ISO 639-1 codes. + final String code; - /// Language native name. - final String nativeName; + /// Language native name. + final String nativeName; - Language({ - required this.name, - required this.code, - required this.nativeName, - }); + Language({ + required this.name, + required this.code, + required this.nativeName, + }); - factory Language.fromMap(Map map) { - return Language( - name: map['name'].toString(), - code: map['code'].toString(), - nativeName: map['nativeName'].toString(), - ); - } + factory Language.fromMap(Map map) { + return Language( + name: map['name'].toString(), + code: map['code'].toString(), + nativeName: map['nativeName'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + @override + Map toMap() { + return { + "name": name, + "code": code, + "nativeName": nativeName, + }; + } } diff --git a/lib/src/models/language_list.dart b/lib/src/models/language_list.dart index 6198d61e..5d78a367 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages that matched your query. - final int total; + /// Total number of languages that matched your query. + final int total; - /// List of languages. - final List languages; + /// List of languages. + final List languages; - LanguageList({ - required this.total, - required this.languages, - }); + LanguageList({ + required this.total, + required this.languages, + }); - factory LanguageList.fromMap(Map map) { - return LanguageList( - total: map['total'], - languages: - List.from(map['languages'].map((p) => Language.fromMap(p))), - ); - } + factory LanguageList.fromMap(Map map) { + return LanguageList( + total: map['total'], + languages: List.from(map['languages'].map((p) => Language.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "languages": languages.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/locale.dart b/lib/src/models/locale.dart index 54dd0c29..3292a896 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,59 +2,59 @@ part of '../../models.dart'; /// Locale class Locale implements Model { - /// User IP address. - final String ip; - - /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format - final String countryCode; - - /// Country name. This field support localization. - final String country; - - /// Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. - final String continentCode; - - /// Continent name. This field support localization. - final String continent; - - /// True if country is part of the European Union. - final bool eu; - - /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format - final String currency; - - Locale({ - required this.ip, - required this.countryCode, - required this.country, - required this.continentCode, - required this.continent, - required this.eu, - required this.currency, - }); - - factory Locale.fromMap(Map map) { - return Locale( - ip: map['ip'].toString(), - countryCode: map['countryCode'].toString(), - country: map['country'].toString(), - continentCode: map['continentCode'].toString(), - continent: map['continent'].toString(), - eu: map['eu'], - currency: map['currency'].toString(), - ); - } - - @override - Map toMap() { - return { - "ip": ip, - "countryCode": countryCode, - "country": country, - "continentCode": continentCode, - "continent": continent, - "eu": eu, - "currency": currency, - }; - } + /// User IP address. + final String ip; + + /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format + final String countryCode; + + /// Country name. This field support localization. + final String country; + + /// Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. + final String continentCode; + + /// Continent name. This field support localization. + final String continent; + + /// True if country is part of the European Union. + final bool eu; + + /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format + final String currency; + + Locale({ + required this.ip, + required this.countryCode, + required this.country, + required this.continentCode, + required this.continent, + required this.eu, + required this.currency, + }); + + factory Locale.fromMap(Map map) { + return Locale( + ip: map['ip'].toString(), + countryCode: map['countryCode'].toString(), + country: map['country'].toString(), + continentCode: map['continentCode'].toString(), + continent: map['continent'].toString(), + eu: map['eu'], + currency: map['currency'].toString(), + ); + } + + @override + Map toMap() { + return { + "ip": ip, + "countryCode": countryCode, + "country": country, + "continentCode": continentCode, + "continent": continent, + "eu": eu, + "currency": currency, + }; + } } diff --git a/lib/src/models/locale_code.dart b/lib/src/models/locale_code.dart index 21405aff..49ef3b0b 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// LocaleCode class LocaleCode implements Model { - /// Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - final String code; + /// Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + final String code; - /// Locale name - final String name; + /// Locale name + final String name; - LocaleCode({ - required this.code, - required this.name, - }); + LocaleCode({ + required this.code, + required this.name, + }); - factory LocaleCode.fromMap(Map map) { - return LocaleCode( - code: map['code'].toString(), - name: map['name'].toString(), - ); - } + factory LocaleCode.fromMap(Map map) { + return LocaleCode( + code: map['code'].toString(), + name: map['name'].toString(), + ); + } - @override - Map toMap() { - return { - "code": code, - "name": name, - }; - } + @override + Map toMap() { + return { + "code": code, + "name": name, + }; + } } diff --git a/lib/src/models/locale_code_list.dart b/lib/src/models/locale_code_list.dart index 202355a4..a3a26b61 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes that matched your query. - final int total; + /// Total number of localeCodes that matched your query. + final int total; - /// List of localeCodes. - final List localeCodes; + /// List of localeCodes. + final List localeCodes; - LocaleCodeList({ - required this.total, - required this.localeCodes, - }); + LocaleCodeList({ + required this.total, + required this.localeCodes, + }); - factory LocaleCodeList.fromMap(Map map) { - return LocaleCodeList( - total: map['total'], - localeCodes: List.from( - map['localeCodes'].map((p) => LocaleCode.fromMap(p))), - ); - } + factory LocaleCodeList.fromMap(Map map) { + return LocaleCodeList( + total: map['total'], + localeCodes: List.from(map['localeCodes'].map((p) => LocaleCode.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "localeCodes": localeCodes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/log.dart b/lib/src/models/log.dart index 572cce50..406fcbcf 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,149 +2,149 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. - final String userId; - - /// User email of the actor recorded for this log. During impersonation, this is the original impersonator. - final String userEmail; - - /// User name of the actor recorded for this log. During impersonation, this is the original impersonator. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. - final String userType; - - /// IP session in use when the session was created. - final String ip; - - /// Log creation date in ISO 8601 format. - final String time; - - /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - final String osCode; - - /// Operating system name. - final String osName; - - /// Operating system version. - final String osVersion; - - /// Client type. - final String clientType; - - /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - final String clientCode; - - /// Client name. - final String clientName; - - /// Client version. - final String clientVersion; - - /// Client engine name. - final String clientEngine; - - /// Client engine name. - final String clientEngineVersion; - - /// Device name. - final String deviceName; - - /// Device brand name. - final String deviceBrand; - - /// Device model name. - final String deviceModel; - - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; - - /// Country name. - final String countryName; - - Log({ - required this.event, - required this.userId, - required this.userEmail, - required this.userName, - required this.mode, - required this.userType, - required this.ip, - required this.time, - required this.osCode, - required this.osName, - required this.osVersion, - required this.clientType, - required this.clientCode, - required this.clientName, - required this.clientVersion, - required this.clientEngine, - required this.clientEngineVersion, - required this.deviceName, - required this.deviceBrand, - required this.deviceModel, - required this.countryCode, - required this.countryName, - }); - - factory Log.fromMap(Map map) { - return Log( - event: map['event'].toString(), - userId: map['userId'].toString(), - userEmail: map['userEmail'].toString(), - userName: map['userName'].toString(), - mode: map['mode'].toString(), - userType: map['userType'].toString(), - ip: map['ip'].toString(), - time: map['time'].toString(), - osCode: map['osCode'].toString(), - osName: map['osName'].toString(), - osVersion: map['osVersion'].toString(), - clientType: map['clientType'].toString(), - clientCode: map['clientCode'].toString(), - clientName: map['clientName'].toString(), - clientVersion: map['clientVersion'].toString(), - clientEngine: map['clientEngine'].toString(), - clientEngineVersion: map['clientEngineVersion'].toString(), - deviceName: map['deviceName'].toString(), - deviceBrand: map['deviceBrand'].toString(), - deviceModel: map['deviceModel'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - ); - } - - @override - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "userType": userType, - "ip": ip, - "time": time, - "osCode": osCode, - "osName": osName, - "osVersion": osVersion, - "clientType": clientType, - "clientCode": clientCode, - "clientName": clientName, - "clientVersion": clientVersion, - "clientEngine": clientEngine, - "clientEngineVersion": clientEngineVersion, - "deviceName": deviceName, - "deviceBrand": deviceBrand, - "deviceModel": deviceModel, - "countryCode": countryCode, - "countryName": countryName, - }; - } + /// Event name. + final String event; + + /// User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. + final String userId; + + /// User email of the actor recorded for this log. During impersonation, this is the original impersonator. + final String userEmail; + + /// User name of the actor recorded for this log. During impersonation, this is the original impersonator. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + final String userType; + + /// IP session in use when the session was created. + final String ip; + + /// Log creation date in ISO 8601 format. + final String time; + + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + final String osCode; + + /// Operating system name. + final String osName; + + /// Operating system version. + final String osVersion; + + /// Client type. + final String clientType; + + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + final String clientCode; + + /// Client name. + final String clientName; + + /// Client version. + final String clientVersion; + + /// Client engine name. + final String clientEngine; + + /// Client engine name. + final String clientEngineVersion; + + /// Device name. + final String deviceName; + + /// Device brand name. + final String deviceBrand; + + /// Device model name. + final String deviceModel; + + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; + + /// Country name. + final String countryName; + + Log({ + required this.event, + required this.userId, + required this.userEmail, + required this.userName, + required this.mode, + required this.userType, + required this.ip, + required this.time, + required this.osCode, + required this.osName, + required this.osVersion, + required this.clientType, + required this.clientCode, + required this.clientName, + required this.clientVersion, + required this.clientEngine, + required this.clientEngineVersion, + required this.deviceName, + required this.deviceBrand, + required this.deviceModel, + required this.countryCode, + required this.countryName, + }); + + factory Log.fromMap(Map map) { + return Log( + event: map['event'].toString(), + userId: map['userId'].toString(), + userEmail: map['userEmail'].toString(), + userName: map['userName'].toString(), + mode: map['mode'].toString(), + userType: map['userType'].toString(), + ip: map['ip'].toString(), + time: map['time'].toString(), + osCode: map['osCode'].toString(), + osName: map['osName'].toString(), + osVersion: map['osVersion'].toString(), + clientType: map['clientType'].toString(), + clientCode: map['clientCode'].toString(), + clientName: map['clientName'].toString(), + clientVersion: map['clientVersion'].toString(), + clientEngine: map['clientEngine'].toString(), + clientEngineVersion: map['clientEngineVersion'].toString(), + deviceName: map['deviceName'].toString(), + deviceBrand: map['deviceBrand'].toString(), + deviceModel: map['deviceModel'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + ); + } + + @override + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "userType": userType, + "ip": ip, + "time": time, + "osCode": osCode, + "osName": osName, + "osVersion": osVersion, + "clientType": clientType, + "clientCode": clientCode, + "clientName": clientName, + "clientVersion": clientVersion, + "clientEngine": clientEngine, + "clientEngineVersion": clientEngineVersion, + "deviceName": deviceName, + "deviceBrand": deviceBrand, + "deviceModel": deviceModel, + "countryCode": countryCode, + "countryName": countryName, + }; + } } diff --git a/lib/src/models/log_list.dart b/lib/src/models/log_list.dart index 3494b111..ebf593c2 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs that matched your query. - final int total; + /// Total number of logs that matched your query. + final int total; - /// List of logs. - final List logs; + /// List of logs. + final List logs; - LogList({ - required this.total, - required this.logs, - }); + LogList({ + required this.total, + required this.logs, + }); - factory LogList.fromMap(Map map) { - return LogList( - total: map['total'], - logs: List.from(map['logs'].map((p) => Log.fromMap(p))), - ); - } + factory LogList.fromMap(Map map) { + return LogList( + total: map['total'], + logs: List.from(map['logs'].map((p) => Log.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "logs": logs.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/membership.dart b/lib/src/models/membership.dart index 87c1755b..68a661b2 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,95 +2,101 @@ part of '../../models.dart'; /// Membership class Membership implements Model { - /// Membership ID. - final String $id; - - /// Membership creation date in ISO 8601 format. - final String $createdAt; - - /// Membership update date in ISO 8601 format. - final String $updatedAt; - - /// User ID. - final String userId; - - /// User name. Hide this attribute by toggling membership privacy in the Console. - final String userName; - - /// User email address. Hide this attribute by toggling membership privacy in the Console. - final String userEmail; - - /// Team ID. - final String teamId; - - /// Team name. - final String teamName; - - /// Date, the user has been invited to join the team in ISO 8601 format. - final String invited; - - /// Date, the user has accepted the invitation to join the team in ISO 8601 format. - final String joined; - - /// User confirmation status, true if the user has joined the team or false otherwise. - final bool confirm; - - /// Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. - final bool mfa; - - /// User list of roles - final List roles; - - Membership({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.userId, - required this.userName, - required this.userEmail, - required this.teamId, - required this.teamName, - required this.invited, - required this.joined, - required this.confirm, - required this.mfa, - required this.roles, - }); - - factory Membership.fromMap(Map map) { - return Membership( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - userId: map['userId'].toString(), - userName: map['userName'].toString(), - userEmail: map['userEmail'].toString(), - teamId: map['teamId'].toString(), - teamName: map['teamName'].toString(), - invited: map['invited'].toString(), - joined: map['joined'].toString(), - confirm: map['confirm'], - mfa: map['mfa'], - roles: List.from(map['roles'] ?? []), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "userName": userName, - "userEmail": userEmail, - "teamId": teamId, - "teamName": teamName, - "invited": invited, - "joined": joined, - "confirm": confirm, - "mfa": mfa, - "roles": roles, - }; - } + /// Membership ID. + final String $id; + + /// Membership creation date in ISO 8601 format. + final String $createdAt; + + /// Membership update date in ISO 8601 format. + final String $updatedAt; + + /// User ID. + final String userId; + + /// User name. Hide this attribute by toggling membership privacy in the Console. + final String userName; + + /// User email address. Hide this attribute by toggling membership privacy in the Console. + final String userEmail; + + /// User phone number. Hide this attribute by toggling membership privacy in the Console. + final String userPhone; + + /// Team ID. + final String teamId; + + /// Team name. + final String teamName; + + /// Date, the user has been invited to join the team in ISO 8601 format. + final String invited; + + /// Date, the user has accepted the invitation to join the team in ISO 8601 format. + final String joined; + + /// User confirmation status, true if the user has joined the team or false otherwise. + final bool confirm; + + /// Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. + final bool mfa; + + /// User list of roles + final List roles; + + Membership({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.userId, + required this.userName, + required this.userEmail, + required this.userPhone, + required this.teamId, + required this.teamName, + required this.invited, + required this.joined, + required this.confirm, + required this.mfa, + required this.roles, + }); + + factory Membership.fromMap(Map map) { + return Membership( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + userId: map['userId'].toString(), + userName: map['userName'].toString(), + userEmail: map['userEmail'].toString(), + userPhone: map['userPhone'].toString(), + teamId: map['teamId'].toString(), + teamName: map['teamName'].toString(), + invited: map['invited'].toString(), + joined: map['joined'].toString(), + confirm: map['confirm'], + mfa: map['mfa'], + roles: List.from(map['roles'] ?? []), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "userId": userId, + "userName": userName, + "userEmail": userEmail, + "userPhone": userPhone, + "teamId": teamId, + "teamName": teamName, + "invited": invited, + "joined": joined, + "confirm": confirm, + "mfa": mfa, + "roles": roles, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index cc664c9f..a0641a28 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships that matched your query. - final int total; + /// Total number of memberships that matched your query. + final int total; - /// List of memberships. - final List memberships; + /// List of memberships. + final List memberships; - MembershipList({ - required this.total, - required this.memberships, - }); + MembershipList({ + required this.total, + required this.memberships, + }); - factory MembershipList.fromMap(Map map) { - return MembershipList( - total: map['total'], - memberships: List.from( - map['memberships'].map((p) => Membership.fromMap(p))), - ); - } + factory MembershipList.fromMap(Map map) { + return MembershipList( + total: map['total'], + memberships: List.from(map['memberships'].map((p) => Membership.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "memberships": memberships.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/message.dart b/lib/src/models/message.dart index affbfdc4..d11834b5 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,96 +2,95 @@ part of '../../models.dart'; /// Message class Message implements Model { - /// Message ID. - final String $id; - - /// Message creation time in ISO 8601 format. - final String $createdAt; - - /// Message update date in ISO 8601 format. - final String $updatedAt; - - /// Message provider type. - final String providerType; - - /// Topic IDs set as recipients. - final List topics; - - /// User IDs set as recipients. - final List users; - - /// Target IDs set as recipients. - final List targets; - - /// The scheduled time for message. - final String? scheduledAt; - - /// The time when the message was delivered. - final String? deliveredAt; - - /// Delivery errors if any. - final List? deliveryErrors; - - /// Number of recipients the message was delivered to. - final int deliveredTotal; - - /// Data of the message. - final Map data; - - /// Status of delivery. - final enums.MessageStatus status; - - Message({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.providerType, - required this.topics, - required this.users, - required this.targets, - this.scheduledAt, - this.deliveredAt, - this.deliveryErrors, - required this.deliveredTotal, - required this.data, - required this.status, - }); - - factory Message.fromMap(Map map) { - return Message( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - providerType: map['providerType'].toString(), - topics: List.from(map['topics'] ?? []), - users: List.from(map['users'] ?? []), - targets: List.from(map['targets'] ?? []), - scheduledAt: map['scheduledAt']?.toString(), - deliveredAt: map['deliveredAt']?.toString(), - deliveryErrors: List.from(map['deliveryErrors'] ?? []), - deliveredTotal: map['deliveredTotal'], - data: map['data'], - status: enums.MessageStatus.values - .firstWhere((e) => e.value == map['status']), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "providerType": providerType, - "topics": topics, - "users": users, - "targets": targets, - "scheduledAt": scheduledAt, - "deliveredAt": deliveredAt, - "deliveryErrors": deliveryErrors, - "deliveredTotal": deliveredTotal, - "data": data, - "status": status.value, - }; - } + /// Message ID. + final String $id; + + /// Message creation time in ISO 8601 format. + final String $createdAt; + + /// Message update date in ISO 8601 format. + final String $updatedAt; + + /// Message provider type. + final String providerType; + + /// Topic IDs set as recipients. + final List topics; + + /// User IDs set as recipients. + final List users; + + /// Target IDs set as recipients. + final List targets; + + /// The scheduled time for message. + final String? scheduledAt; + + /// The time when the message was delivered. + final String? deliveredAt; + + /// Delivery errors if any. + final List? deliveryErrors; + + /// Number of recipients the message was delivered to. + final int deliveredTotal; + + /// Data of the message. + final Map data; + + /// Status of delivery. + final enums.MessageStatus status; + + Message({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.providerType, + required this.topics, + required this.users, + required this.targets, + this.scheduledAt, + this.deliveredAt, + this.deliveryErrors, + required this.deliveredTotal, + required this.data, + required this.status, + }); + + factory Message.fromMap(Map map) { + return Message( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + providerType: map['providerType'].toString(), + topics: List.from(map['topics'] ?? []), + users: List.from(map['users'] ?? []), + targets: List.from(map['targets'] ?? []), + scheduledAt: map['scheduledAt']?.toString(), + deliveredAt: map['deliveredAt']?.toString(), + deliveryErrors: List.from(map['deliveryErrors'] ?? []), + deliveredTotal: map['deliveredTotal'], + data: map['data'], + status: enums.MessageStatus.values.firstWhere((e) => e.value == map['status']), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "providerType": providerType, + "topics": topics, + "users": users, + "targets": targets, + "scheduledAt": scheduledAt, + "deliveredAt": deliveredAt, + "deliveryErrors": deliveryErrors, + "deliveredTotal": deliveredTotal, + "data": data, + "status": status.value, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 829d6f71..16349d41 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages that matched your query. - final int total; + /// Total number of messages that matched your query. + final int total; - /// List of messages. - final List messages; + /// List of messages. + final List messages; - MessageList({ - required this.total, - required this.messages, - }); + MessageList({ + required this.total, + required this.messages, + }); - factory MessageList.fromMap(Map map) { - return MessageList( - total: map['total'], - messages: - List.from(map['messages'].map((p) => Message.fromMap(p))), - ); - } + factory MessageList.fromMap(Map map) { + return MessageList( + total: map['total'], + messages: List.from(map['messages'].map((p) => Message.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "messages": messages.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/mfa_challenge.dart b/lib/src/models/mfa_challenge.dart index fa385541..3d2e2335 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// MFA Challenge class MfaChallenge implements Model { - /// Token ID. - final String $id; + /// Token ID. + final String $id; - /// Token creation date in ISO 8601 format. - final String $createdAt; + /// Token creation date in ISO 8601 format. + final String $createdAt; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Token expiration date in ISO 8601 format. - final String expire; + /// Token expiration date in ISO 8601 format. + final String expire; - MfaChallenge({ - required this.$id, - required this.$createdAt, - required this.userId, - required this.expire, - }); + MfaChallenge({ + required this.$id, + required this.$createdAt, + required this.userId, + required this.expire, + }); - factory MfaChallenge.fromMap(Map map) { - return MfaChallenge( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - userId: map['userId'].toString(), - expire: map['expire'].toString(), - ); - } + factory MfaChallenge.fromMap(Map map) { + return MfaChallenge( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + userId: map['userId'].toString(), + expire: map['expire'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "userId": userId, + "expire": expire, + }; + } } diff --git a/lib/src/models/mfa_factors.dart b/lib/src/models/mfa_factors.dart index 2777de7f..a7e5fefc 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// MFAFactors class MfaFactors implements Model { - /// Can TOTP be used for MFA challenge for this account. - final bool totp; + /// Can TOTP be used for MFA challenge for this account. + final bool totp; - /// Can phone (SMS) be used for MFA challenge for this account. - final bool phone; + /// Can phone (SMS) be used for MFA challenge for this account. + final bool phone; - /// Can email be used for MFA challenge for this account. - final bool email; + /// Can email be used for MFA challenge for this account. + final bool email; - /// Can recovery code be used for MFA challenge for this account. - final bool recoveryCode; + /// Can recovery code be used for MFA challenge for this account. + final bool recoveryCode; - MfaFactors({ - required this.totp, - required this.phone, - required this.email, - required this.recoveryCode, - }); + MfaFactors({ + required this.totp, + required this.phone, + required this.email, + required this.recoveryCode, + }); - factory MfaFactors.fromMap(Map map) { - return MfaFactors( - totp: map['totp'], - phone: map['phone'], - email: map['email'], - recoveryCode: map['recoveryCode'], - ); - } + factory MfaFactors.fromMap(Map map) { + return MfaFactors( + totp: map['totp'], + phone: map['phone'], + email: map['email'], + recoveryCode: map['recoveryCode'], + ); + } - @override - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + @override + Map toMap() { + return { + "totp": totp, + "phone": phone, + "email": email, + "recoveryCode": recoveryCode, + }; + } } diff --git a/lib/src/models/mfa_recovery_codes.dart b/lib/src/models/mfa_recovery_codes.dart index 864a5db8..33036476 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// MFA Recovery Codes class MfaRecoveryCodes implements Model { - /// Recovery codes. - final List recoveryCodes; + /// Recovery codes. + final List recoveryCodes; - MfaRecoveryCodes({ - required this.recoveryCodes, - }); + MfaRecoveryCodes({ + required this.recoveryCodes, + }); - factory MfaRecoveryCodes.fromMap(Map map) { - return MfaRecoveryCodes( - recoveryCodes: List.from(map['recoveryCodes'] ?? []), - ); - } + factory MfaRecoveryCodes.fromMap(Map map) { + return MfaRecoveryCodes( + recoveryCodes: List.from(map['recoveryCodes'] ?? []), + ); + } - @override - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + @override + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index fe5327fc..05cab363 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// MFAType class MfaType implements Model { - /// Secret token used for TOTP factor. - final String secret; + /// Secret token used for TOTP factor. + final String secret; - /// URI for authenticator apps. - final String uri; + /// URI for authenticator apps. + final String uri; - MfaType({ - required this.secret, - required this.uri, - }); + MfaType({ + required this.secret, + required this.uri, + }); - factory MfaType.fromMap(Map map) { - return MfaType( - secret: map['secret'].toString(), - uri: map['uri'].toString(), - ); - } + factory MfaType.fromMap(Map map) { + return MfaType( + secret: map['secret'].toString(), + uri: map['uri'].toString(), + ); + } - @override - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + @override + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } diff --git a/lib/src/models/mock_number.dart b/lib/src/models/mock_number.dart index a87a8281..b8e9b525 100644 --- a/lib/src/models/mock_number.dart +++ b/lib/src/models/mock_number.dart @@ -2,29 +2,41 @@ part of '../../models.dart'; /// Mock Number class MockNumber implements Model { - /// Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. - final String phone; + /// Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. + final String number; - /// Mock OTP for the number. - final String otp; + /// Mock OTP for the number. + final String otp; - MockNumber({ - required this.phone, - required this.otp, - }); + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - factory MockNumber.fromMap(Map map) { - return MockNumber( - phone: map['phone'].toString(), - otp: map['otp'].toString(), - ); - } + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - @override - Map toMap() { - return { - "phone": phone, - "otp": otp, - }; - } + MockNumber({ + required this.number, + required this.otp, + required this.$createdAt, + required this.$updatedAt, + }); + + factory MockNumber.fromMap(Map map) { + return MockNumber( + number: map['number'].toString(), + otp: map['otp'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "number": number, + "otp": otp, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + }; + } } diff --git a/lib/src/models/mock_number_list.dart b/lib/src/models/mock_number_list.dart new file mode 100644 index 00000000..f4c07f58 --- /dev/null +++ b/lib/src/models/mock_number_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Mock Numbers List +class MockNumberList implements Model { + /// Total number of mockNumbers that matched your query. + final int total; + + /// List of mockNumbers. + final List mockNumbers; + + MockNumberList({ + required this.total, + required this.mockNumbers, + }); + + factory MockNumberList.fromMap(Map map) { + return MockNumberList( + total: map['total'], + mockNumbers: List.from(map['mockNumbers'].map((p) => MockNumber.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "mockNumbers": mockNumbers.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/model.dart b/lib/src/models/model.dart index f810a35b..48e5b84a 100644 --- a/lib/src/models/model.dart +++ b/lib/src/models/model.dart @@ -2,4 +2,4 @@ part of '../../models.dart'; abstract class Model { Map toMap(); -} +} \ No newline at end of file diff --git a/lib/src/models/o_auth2_amazon.dart b/lib/src/models/o_auth2_amazon.dart new file mode 100644 index 00000000..a2675157 --- /dev/null +++ b/lib/src/models/o_auth2_amazon.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Amazon +class OAuth2Amazon implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Amazon OAuth2 client ID. + final String clientId; + + /// Amazon OAuth2 client secret. + final String clientSecret; + + OAuth2Amazon({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Amazon.fromMap(Map map) { + return OAuth2Amazon( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_apple.dart b/lib/src/models/o_auth2_apple.dart new file mode 100644 index 00000000..8fbc0e44 --- /dev/null +++ b/lib/src/models/o_auth2_apple.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// OAuth2Apple +class OAuth2Apple implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Apple OAuth2 service ID. + final String serviceId; + + /// Apple OAuth2 key ID. + final String keyId; + + /// Apple OAuth2 team ID. + final String teamId; + + /// Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. + final String p8File; + + OAuth2Apple({ + required this.$id, + required this.enabled, + required this.serviceId, + required this.keyId, + required this.teamId, + required this.p8File, + }); + + factory OAuth2Apple.fromMap(Map map) { + return OAuth2Apple( + $id: map['\$id'].toString(), + enabled: map['enabled'], + serviceId: map['serviceId'].toString(), + keyId: map['keyId'].toString(), + teamId: map['teamId'].toString(), + p8File: map['p8File'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "serviceId": serviceId, + "keyId": keyId, + "teamId": teamId, + "p8File": p8File, + }; + } +} diff --git a/lib/src/models/o_auth2_auth0.dart b/lib/src/models/o_auth2_auth0.dart new file mode 100644 index 00000000..2ccff413 --- /dev/null +++ b/lib/src/models/o_auth2_auth0.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Auth0 +class OAuth2Auth0 implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Auth0 OAuth2 client ID. + final String clientId; + + /// Auth0 OAuth2 client secret. + final String clientSecret; + + /// Auth0 OAuth2 endpoint domain. + final String endpoint; + + OAuth2Auth0({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2Auth0.fromMap(Map map) { + return OAuth2Auth0( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_authentik.dart b/lib/src/models/o_auth2_authentik.dart new file mode 100644 index 00000000..2f72d83a --- /dev/null +++ b/lib/src/models/o_auth2_authentik.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Authentik +class OAuth2Authentik implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Authentik OAuth2 client ID. + final String clientId; + + /// Authentik OAuth2 client secret. + final String clientSecret; + + /// Authentik OAuth2 endpoint domain. + final String endpoint; + + OAuth2Authentik({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2Authentik.fromMap(Map map) { + return OAuth2Authentik( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_autodesk.dart b/lib/src/models/o_auth2_autodesk.dart new file mode 100644 index 00000000..bb187b20 --- /dev/null +++ b/lib/src/models/o_auth2_autodesk.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Autodesk +class OAuth2Autodesk implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Autodesk OAuth2 client ID. + final String clientId; + + /// Autodesk OAuth2 client secret. + final String clientSecret; + + OAuth2Autodesk({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Autodesk.fromMap(Map map) { + return OAuth2Autodesk( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_bitbucket.dart b/lib/src/models/o_auth2_bitbucket.dart new file mode 100644 index 00000000..218ba149 --- /dev/null +++ b/lib/src/models/o_auth2_bitbucket.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Bitbucket +class OAuth2Bitbucket implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Bitbucket OAuth2 key. + final String key; + + /// Bitbucket OAuth2 secret. + final String secret; + + OAuth2Bitbucket({ + required this.$id, + required this.enabled, + required this.key, + required this.secret, + }); + + factory OAuth2Bitbucket.fromMap(Map map) { + return OAuth2Bitbucket( + $id: map['\$id'].toString(), + enabled: map['enabled'], + key: map['key'].toString(), + secret: map['secret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "key": key, + "secret": secret, + }; + } +} diff --git a/lib/src/models/o_auth2_bitly.dart b/lib/src/models/o_auth2_bitly.dart new file mode 100644 index 00000000..466083b4 --- /dev/null +++ b/lib/src/models/o_auth2_bitly.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Bitly +class OAuth2Bitly implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Bitly OAuth2 client ID. + final String clientId; + + /// Bitly OAuth2 client secret. + final String clientSecret; + + OAuth2Bitly({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Bitly.fromMap(Map map) { + return OAuth2Bitly( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_box.dart b/lib/src/models/o_auth2_box.dart new file mode 100644 index 00000000..05c41eff --- /dev/null +++ b/lib/src/models/o_auth2_box.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Box +class OAuth2Box implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Box OAuth2 client ID. + final String clientId; + + /// Box OAuth2 client secret. + final String clientSecret; + + OAuth2Box({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Box.fromMap(Map map) { + return OAuth2Box( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_dailymotion.dart b/lib/src/models/o_auth2_dailymotion.dart new file mode 100644 index 00000000..8936d374 --- /dev/null +++ b/lib/src/models/o_auth2_dailymotion.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Dailymotion +class OAuth2Dailymotion implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Dailymotion OAuth2 API key. + final String apiKey; + + /// Dailymotion OAuth2 API secret. + final String apiSecret; + + OAuth2Dailymotion({ + required this.$id, + required this.enabled, + required this.apiKey, + required this.apiSecret, + }); + + factory OAuth2Dailymotion.fromMap(Map map) { + return OAuth2Dailymotion( + $id: map['\$id'].toString(), + enabled: map['enabled'], + apiKey: map['apiKey'].toString(), + apiSecret: map['apiSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "apiKey": apiKey, + "apiSecret": apiSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_discord.dart b/lib/src/models/o_auth2_discord.dart new file mode 100644 index 00000000..ee688578 --- /dev/null +++ b/lib/src/models/o_auth2_discord.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Discord +class OAuth2Discord implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Discord OAuth2 client ID. + final String clientId; + + /// Discord OAuth2 client secret. + final String clientSecret; + + OAuth2Discord({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Discord.fromMap(Map map) { + return OAuth2Discord( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_disqus.dart b/lib/src/models/o_auth2_disqus.dart new file mode 100644 index 00000000..55b6fbf2 --- /dev/null +++ b/lib/src/models/o_auth2_disqus.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Disqus +class OAuth2Disqus implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Disqus OAuth2 public key. + final String publicKey; + + /// Disqus OAuth2 secret key. + final String secretKey; + + OAuth2Disqus({ + required this.$id, + required this.enabled, + required this.publicKey, + required this.secretKey, + }); + + factory OAuth2Disqus.fromMap(Map map) { + return OAuth2Disqus( + $id: map['\$id'].toString(), + enabled: map['enabled'], + publicKey: map['publicKey'].toString(), + secretKey: map['secretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "publicKey": publicKey, + "secretKey": secretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_dropbox.dart b/lib/src/models/o_auth2_dropbox.dart new file mode 100644 index 00000000..883bb9dd --- /dev/null +++ b/lib/src/models/o_auth2_dropbox.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Dropbox +class OAuth2Dropbox implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Dropbox OAuth2 app key. + final String appKey; + + /// Dropbox OAuth2 app secret. + final String appSecret; + + OAuth2Dropbox({ + required this.$id, + required this.enabled, + required this.appKey, + required this.appSecret, + }); + + factory OAuth2Dropbox.fromMap(Map map) { + return OAuth2Dropbox( + $id: map['\$id'].toString(), + enabled: map['enabled'], + appKey: map['appKey'].toString(), + appSecret: map['appSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "appKey": appKey, + "appSecret": appSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_etsy.dart b/lib/src/models/o_auth2_etsy.dart new file mode 100644 index 00000000..7aedaffc --- /dev/null +++ b/lib/src/models/o_auth2_etsy.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Etsy +class OAuth2Etsy implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Etsy OAuth2 keystring. + final String keyString; + + /// Etsy OAuth2 shared secret. + final String sharedSecret; + + OAuth2Etsy({ + required this.$id, + required this.enabled, + required this.keyString, + required this.sharedSecret, + }); + + factory OAuth2Etsy.fromMap(Map map) { + return OAuth2Etsy( + $id: map['\$id'].toString(), + enabled: map['enabled'], + keyString: map['keyString'].toString(), + sharedSecret: map['sharedSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "keyString": keyString, + "sharedSecret": sharedSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_facebook.dart b/lib/src/models/o_auth2_facebook.dart new file mode 100644 index 00000000..b6728d64 --- /dev/null +++ b/lib/src/models/o_auth2_facebook.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Facebook +class OAuth2Facebook implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Facebook OAuth2 app ID. + final String appId; + + /// Facebook OAuth2 app secret. + final String appSecret; + + OAuth2Facebook({ + required this.$id, + required this.enabled, + required this.appId, + required this.appSecret, + }); + + factory OAuth2Facebook.fromMap(Map map) { + return OAuth2Facebook( + $id: map['\$id'].toString(), + enabled: map['enabled'], + appId: map['appId'].toString(), + appSecret: map['appSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "appId": appId, + "appSecret": appSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_figma.dart b/lib/src/models/o_auth2_figma.dart new file mode 100644 index 00000000..f1b9a53e --- /dev/null +++ b/lib/src/models/o_auth2_figma.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Figma +class OAuth2Figma implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Figma OAuth2 client ID. + final String clientId; + + /// Figma OAuth2 client secret. + final String clientSecret; + + OAuth2Figma({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Figma.fromMap(Map map) { + return OAuth2Figma( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_fusion_auth.dart b/lib/src/models/o_auth2_fusion_auth.dart new file mode 100644 index 00000000..48fc42b2 --- /dev/null +++ b/lib/src/models/o_auth2_fusion_auth.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2FusionAuth +class OAuth2FusionAuth implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// FusionAuth OAuth2 client ID. + final String clientId; + + /// FusionAuth OAuth2 client secret. + final String clientSecret; + + /// FusionAuth OAuth2 endpoint domain. + final String endpoint; + + OAuth2FusionAuth({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2FusionAuth.fromMap(Map map) { + return OAuth2FusionAuth( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_github.dart b/lib/src/models/o_auth2_github.dart new file mode 100644 index 00000000..99b40862 --- /dev/null +++ b/lib/src/models/o_auth2_github.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2GitHub +class OAuth2Github implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. + final String clientId; + + /// GitHub OAuth2 client secret. + final String clientSecret; + + OAuth2Github({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Github.fromMap(Map map) { + return OAuth2Github( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_gitlab.dart b/lib/src/models/o_auth2_gitlab.dart new file mode 100644 index 00000000..bfa92437 --- /dev/null +++ b/lib/src/models/o_auth2_gitlab.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Gitlab +class OAuth2Gitlab implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// GitLab OAuth2 application ID. + final String applicationId; + + /// GitLab OAuth2 secret. + final String secret; + + /// GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. + final String endpoint; + + OAuth2Gitlab({ + required this.$id, + required this.enabled, + required this.applicationId, + required this.secret, + required this.endpoint, + }); + + factory OAuth2Gitlab.fromMap(Map map) { + return OAuth2Gitlab( + $id: map['\$id'].toString(), + enabled: map['enabled'], + applicationId: map['applicationId'].toString(), + secret: map['secret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "applicationId": applicationId, + "secret": secret, + "endpoint": endpoint, + }; + } +} diff --git a/lib/src/models/o_auth2_google.dart b/lib/src/models/o_auth2_google.dart new file mode 100644 index 00000000..a541934b --- /dev/null +++ b/lib/src/models/o_auth2_google.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Google +class OAuth2Google implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Google OAuth2 client ID. + final String clientId; + + /// Google OAuth2 client secret. + final String clientSecret; + + OAuth2Google({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Google.fromMap(Map map) { + return OAuth2Google( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_keycloak.dart b/lib/src/models/o_auth2_keycloak.dart new file mode 100644 index 00000000..890cfad9 --- /dev/null +++ b/lib/src/models/o_auth2_keycloak.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// OAuth2Keycloak +class OAuth2Keycloak implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Keycloak OAuth2 client ID. + final String clientId; + + /// Keycloak OAuth2 client secret. + final String clientSecret; + + /// Keycloak OAuth2 endpoint domain. + final String endpoint; + + /// Keycloak OAuth2 realm name. + final String realmName; + + OAuth2Keycloak({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + required this.realmName, + }); + + factory OAuth2Keycloak.fromMap(Map map) { + return OAuth2Keycloak( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + realmName: map['realmName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + "realmName": realmName, + }; + } +} diff --git a/lib/src/models/o_auth2_kick.dart b/lib/src/models/o_auth2_kick.dart new file mode 100644 index 00000000..3cf9fce5 --- /dev/null +++ b/lib/src/models/o_auth2_kick.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Kick +class OAuth2Kick implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Kick OAuth2 client ID. + final String clientId; + + /// Kick OAuth2 client secret. + final String clientSecret; + + OAuth2Kick({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Kick.fromMap(Map map) { + return OAuth2Kick( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_linkedin.dart b/lib/src/models/o_auth2_linkedin.dart new file mode 100644 index 00000000..dd44dacf --- /dev/null +++ b/lib/src/models/o_auth2_linkedin.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Linkedin +class OAuth2Linkedin implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// LinkedIn OAuth2 client ID. + final String clientId; + + /// LinkedIn OAuth2 primary client secret. + final String primaryClientSecret; + + OAuth2Linkedin({ + required this.$id, + required this.enabled, + required this.clientId, + required this.primaryClientSecret, + }); + + factory OAuth2Linkedin.fromMap(Map map) { + return OAuth2Linkedin( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + primaryClientSecret: map['primaryClientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "primaryClientSecret": primaryClientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_microsoft.dart b/lib/src/models/o_auth2_microsoft.dart new file mode 100644 index 00000000..eb2ec09c --- /dev/null +++ b/lib/src/models/o_auth2_microsoft.dart @@ -0,0 +1,48 @@ +part of '../../models.dart'; + +/// OAuth2Microsoft +class OAuth2Microsoft implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Microsoft OAuth2 application ID. + final String applicationId; + + /// Microsoft OAuth2 application secret. + final String applicationSecret; + + /// Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. + final String tenant; + + OAuth2Microsoft({ + required this.$id, + required this.enabled, + required this.applicationId, + required this.applicationSecret, + required this.tenant, + }); + + factory OAuth2Microsoft.fromMap(Map map) { + return OAuth2Microsoft( + $id: map['\$id'].toString(), + enabled: map['enabled'], + applicationId: map['applicationId'].toString(), + applicationSecret: map['applicationSecret'].toString(), + tenant: map['tenant'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "applicationId": applicationId, + "applicationSecret": applicationSecret, + "tenant": tenant, + }; + } +} diff --git a/lib/src/models/o_auth2_notion.dart b/lib/src/models/o_auth2_notion.dart new file mode 100644 index 00000000..92491204 --- /dev/null +++ b/lib/src/models/o_auth2_notion.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Notion +class OAuth2Notion implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Notion OAuth2 client ID. + final String oauthClientId; + + /// Notion OAuth2 client secret. + final String oauthClientSecret; + + OAuth2Notion({ + required this.$id, + required this.enabled, + required this.oauthClientId, + required this.oauthClientSecret, + }); + + factory OAuth2Notion.fromMap(Map map) { + return OAuth2Notion( + $id: map['\$id'].toString(), + enabled: map['enabled'], + oauthClientId: map['oauthClientId'].toString(), + oauthClientSecret: map['oauthClientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "oauthClientId": oauthClientId, + "oauthClientSecret": oauthClientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_oidc.dart b/lib/src/models/o_auth2_oidc.dart new file mode 100644 index 00000000..4bb1312b --- /dev/null +++ b/lib/src/models/o_auth2_oidc.dart @@ -0,0 +1,66 @@ +part of '../../models.dart'; + +/// OAuth2Oidc +class OAuth2Oidc implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// OpenID Connect OAuth2 client ID. + final String clientId; + + /// OpenID Connect OAuth2 client secret. + final String clientSecret; + + /// OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. + final String wellKnownURL; + + /// OpenID Connect authorization endpoint URL. + final String authorizationURL; + + /// OpenID Connect token endpoint URL. + final String tokenURL; + + /// OpenID Connect user info endpoint URL. + final String userInfoURL; + + OAuth2Oidc({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.wellKnownURL, + required this.authorizationURL, + required this.tokenURL, + required this.userInfoURL, + }); + + factory OAuth2Oidc.fromMap(Map map) { + return OAuth2Oidc( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + wellKnownURL: map['wellKnownURL'].toString(), + authorizationURL: map['authorizationURL'].toString(), + tokenURL: map['tokenURL'].toString(), + userInfoURL: map['userInfoURL'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "wellKnownURL": wellKnownURL, + "authorizationURL": authorizationURL, + "tokenURL": tokenURL, + "userInfoURL": userInfoURL, + }; + } +} diff --git a/lib/src/models/o_auth2_okta.dart b/lib/src/models/o_auth2_okta.dart new file mode 100644 index 00000000..046801f3 --- /dev/null +++ b/lib/src/models/o_auth2_okta.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// OAuth2Okta +class OAuth2Okta implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Okta OAuth2 client ID. + final String clientId; + + /// Okta OAuth2 client secret. + final String clientSecret; + + /// Okta OAuth2 domain. + final String domain; + + /// Okta OAuth2 authorization server ID. + final String authorizationServerId; + + OAuth2Okta({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.domain, + required this.authorizationServerId, + }); + + factory OAuth2Okta.fromMap(Map map) { + return OAuth2Okta( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + domain: map['domain'].toString(), + authorizationServerId: map['authorizationServerId'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "domain": domain, + "authorizationServerId": authorizationServerId, + }; + } +} diff --git a/lib/src/models/o_auth2_paypal.dart b/lib/src/models/o_auth2_paypal.dart new file mode 100644 index 00000000..1d87c582 --- /dev/null +++ b/lib/src/models/o_auth2_paypal.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Paypal +class OAuth2Paypal implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// PayPal OAuth2 client ID. + final String clientId; + + /// PayPal OAuth2 secret key. + final String secretKey; + + OAuth2Paypal({ + required this.$id, + required this.enabled, + required this.clientId, + required this.secretKey, + }); + + factory OAuth2Paypal.fromMap(Map map) { + return OAuth2Paypal( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + secretKey: map['secretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "secretKey": secretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_podio.dart b/lib/src/models/o_auth2_podio.dart new file mode 100644 index 00000000..cdf9504a --- /dev/null +++ b/lib/src/models/o_auth2_podio.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Podio +class OAuth2Podio implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Podio OAuth2 client ID. + final String clientId; + + /// Podio OAuth2 client secret. + final String clientSecret; + + OAuth2Podio({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Podio.fromMap(Map map) { + return OAuth2Podio( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_provider_list.dart b/lib/src/models/o_auth2_provider_list.dart new file mode 100644 index 00000000..e02e9bd3 --- /dev/null +++ b/lib/src/models/o_auth2_provider_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// OAuth2 Providers List +class OAuth2ProviderList implements Model { + /// Total number of OAuth2 providers in the given project. + final int total; + + /// List of OAuth2 providers. + final List providers; + + OAuth2ProviderList({ + required this.total, + required this.providers, + }); + + factory OAuth2ProviderList.fromMap(Map map) { + return OAuth2ProviderList( + total: map['total'], + providers: List.from(map['providers'] ?? []), + ); + } + + @override + Map toMap() { + return { + "total": total, + "providers": providers, + }; + } +} diff --git a/lib/src/models/o_auth2_salesforce.dart b/lib/src/models/o_auth2_salesforce.dart new file mode 100644 index 00000000..ec235842 --- /dev/null +++ b/lib/src/models/o_auth2_salesforce.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Salesforce +class OAuth2Salesforce implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Salesforce OAuth2 consumer key. + final String customerKey; + + /// Salesforce OAuth2 consumer secret. + final String customerSecret; + + OAuth2Salesforce({ + required this.$id, + required this.enabled, + required this.customerKey, + required this.customerSecret, + }); + + factory OAuth2Salesforce.fromMap(Map map) { + return OAuth2Salesforce( + $id: map['\$id'].toString(), + enabled: map['enabled'], + customerKey: map['customerKey'].toString(), + customerSecret: map['customerSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "customerKey": customerKey, + "customerSecret": customerSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_slack.dart b/lib/src/models/o_auth2_slack.dart new file mode 100644 index 00000000..abace934 --- /dev/null +++ b/lib/src/models/o_auth2_slack.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Slack +class OAuth2Slack implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Slack OAuth2 client ID. + final String clientId; + + /// Slack OAuth2 client secret. + final String clientSecret; + + OAuth2Slack({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Slack.fromMap(Map map) { + return OAuth2Slack( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_spotify.dart b/lib/src/models/o_auth2_spotify.dart new file mode 100644 index 00000000..b1e1e1cc --- /dev/null +++ b/lib/src/models/o_auth2_spotify.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Spotify +class OAuth2Spotify implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Spotify OAuth2 client ID. + final String clientId; + + /// Spotify OAuth2 client secret. + final String clientSecret; + + OAuth2Spotify({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Spotify.fromMap(Map map) { + return OAuth2Spotify( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_stripe.dart b/lib/src/models/o_auth2_stripe.dart new file mode 100644 index 00000000..f348f287 --- /dev/null +++ b/lib/src/models/o_auth2_stripe.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Stripe +class OAuth2Stripe implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Stripe OAuth2 client ID. + final String clientId; + + /// Stripe OAuth2 API secret key. + final String apiSecretKey; + + OAuth2Stripe({ + required this.$id, + required this.enabled, + required this.clientId, + required this.apiSecretKey, + }); + + factory OAuth2Stripe.fromMap(Map map) { + return OAuth2Stripe( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + apiSecretKey: map['apiSecretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "apiSecretKey": apiSecretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_tradeshift.dart b/lib/src/models/o_auth2_tradeshift.dart new file mode 100644 index 00000000..769619e2 --- /dev/null +++ b/lib/src/models/o_auth2_tradeshift.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Tradeshift +class OAuth2Tradeshift implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Tradeshift OAuth2 client ID. + final String oauth2ClientId; + + /// Tradeshift OAuth2 client secret. + final String oauth2ClientSecret; + + OAuth2Tradeshift({ + required this.$id, + required this.enabled, + required this.oauth2ClientId, + required this.oauth2ClientSecret, + }); + + factory OAuth2Tradeshift.fromMap(Map map) { + return OAuth2Tradeshift( + $id: map['\$id'].toString(), + enabled: map['enabled'], + oauth2ClientId: map['oauth2ClientId'].toString(), + oauth2ClientSecret: map['oauth2ClientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "oauth2ClientId": oauth2ClientId, + "oauth2ClientSecret": oauth2ClientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_twitch.dart b/lib/src/models/o_auth2_twitch.dart new file mode 100644 index 00000000..643bf8e4 --- /dev/null +++ b/lib/src/models/o_auth2_twitch.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Twitch +class OAuth2Twitch implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Twitch OAuth2 client ID. + final String clientId; + + /// Twitch OAuth2 client secret. + final String clientSecret; + + OAuth2Twitch({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Twitch.fromMap(Map map) { + return OAuth2Twitch( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_word_press.dart b/lib/src/models/o_auth2_word_press.dart new file mode 100644 index 00000000..6605b590 --- /dev/null +++ b/lib/src/models/o_auth2_word_press.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2WordPress +class OAuth2WordPress implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// WordPress OAuth2 client ID. + final String clientId; + + /// WordPress OAuth2 client secret. + final String clientSecret; + + OAuth2WordPress({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2WordPress.fromMap(Map map) { + return OAuth2WordPress( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_x.dart b/lib/src/models/o_auth2_x.dart new file mode 100644 index 00000000..9c7773f0 --- /dev/null +++ b/lib/src/models/o_auth2_x.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2X +class OAuth2X implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// X OAuth2 customer key. + final String customerKey; + + /// X OAuth2 secret key. + final String secretKey; + + OAuth2X({ + required this.$id, + required this.enabled, + required this.customerKey, + required this.secretKey, + }); + + factory OAuth2X.fromMap(Map map) { + return OAuth2X( + $id: map['\$id'].toString(), + enabled: map['enabled'], + customerKey: map['customerKey'].toString(), + secretKey: map['secretKey'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "customerKey": customerKey, + "secretKey": secretKey, + }; + } +} diff --git a/lib/src/models/o_auth2_yahoo.dart b/lib/src/models/o_auth2_yahoo.dart new file mode 100644 index 00000000..5579b44d --- /dev/null +++ b/lib/src/models/o_auth2_yahoo.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Yahoo +class OAuth2Yahoo implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Yahoo OAuth2 client ID. + final String clientId; + + /// Yahoo OAuth2 client secret. + final String clientSecret; + + OAuth2Yahoo({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Yahoo.fromMap(Map map) { + return OAuth2Yahoo( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_yandex.dart b/lib/src/models/o_auth2_yandex.dart new file mode 100644 index 00000000..444bede9 --- /dev/null +++ b/lib/src/models/o_auth2_yandex.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Yandex +class OAuth2Yandex implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Yandex OAuth2 client ID. + final String clientId; + + /// Yandex OAuth2 client secret. + final String clientSecret; + + OAuth2Yandex({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Yandex.fromMap(Map map) { + return OAuth2Yandex( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_zoho.dart b/lib/src/models/o_auth2_zoho.dart new file mode 100644 index 00000000..829bf8bf --- /dev/null +++ b/lib/src/models/o_auth2_zoho.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Zoho +class OAuth2Zoho implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Zoho OAuth2 client ID. + final String clientId; + + /// Zoho OAuth2 client secret. + final String clientSecret; + + OAuth2Zoho({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Zoho.fromMap(Map map) { + return OAuth2Zoho( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/o_auth2_zoom.dart b/lib/src/models/o_auth2_zoom.dart new file mode 100644 index 00000000..6f1f6126 --- /dev/null +++ b/lib/src/models/o_auth2_zoom.dart @@ -0,0 +1,42 @@ +part of '../../models.dart'; + +/// OAuth2Zoom +class OAuth2Zoom implements Model { + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Zoom OAuth2 client ID. + final String clientId; + + /// Zoom OAuth2 client secret. + final String clientSecret; + + OAuth2Zoom({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); + + factory OAuth2Zoom.fromMap(Map map) { + return OAuth2Zoom( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } +} diff --git a/lib/src/models/phone.dart b/lib/src/models/phone.dart index 60e2abd9..7ac578e2 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,35 +2,35 @@ part of '../../models.dart'; /// Phone class Phone implements Model { - /// Phone code. - final String code; + /// Phone code. + final String code; - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; - /// Country name. - final String countryName; + /// Country name. + final String countryName; - Phone({ - required this.code, - required this.countryCode, - required this.countryName, - }); + Phone({ + required this.code, + required this.countryCode, + required this.countryName, + }); - factory Phone.fromMap(Map map) { - return Phone( - code: map['code'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - ); - } + factory Phone.fromMap(Map map) { + return Phone( + code: map['code'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + ); + } - @override - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + @override + Map toMap() { + return { + "code": code, + "countryCode": countryCode, + "countryName": countryName, + }; + } } diff --git a/lib/src/models/phone_list.dart b/lib/src/models/phone_list.dart index 1a197fc7..9791d590 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones that matched your query. - final int total; + /// Total number of phones that matched your query. + final int total; - /// List of phones. - final List phones; + /// List of phones. + final List phones; - PhoneList({ - required this.total, - required this.phones, - }); + PhoneList({ + required this.total, + required this.phones, + }); - factory PhoneList.fromMap(Map map) { - return PhoneList( - total: map['total'], - phones: List.from(map['phones'].map((p) => Phone.fromMap(p))), - ); - } + factory PhoneList.fromMap(Map map) { + return PhoneList( + total: map['total'], + phones: List.from(map['phones'].map((p) => Phone.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/platform_android.dart b/lib/src/models/platform_android.dart index 0f8d940d..57421cbf 100644 --- a/lib/src/models/platform_android.dart +++ b/lib/src/models/platform_android.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Android class PlatformAndroid implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Android application ID. - final String applicationId; - - PlatformAndroid({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.applicationId, - }); - - factory PlatformAndroid.fromMap(Map map) { - return PlatformAndroid( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - applicationId: map['applicationId'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "applicationId": applicationId, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Android application ID. + final String applicationId; + + PlatformAndroid({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.applicationId, + }); + + factory PlatformAndroid.fromMap(Map map) { + return PlatformAndroid( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + applicationId: map['applicationId'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "applicationId": applicationId, + }; + } } diff --git a/lib/src/models/platform_apple.dart b/lib/src/models/platform_apple.dart index b421c15d..37aaa817 100644 --- a/lib/src/models/platform_apple.dart +++ b/lib/src/models/platform_apple.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Apple class PlatformApple implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Apple bundle identifier. - final String bundleIdentifier; - - PlatformApple({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.bundleIdentifier, - }); - - factory PlatformApple.fromMap(Map map) { - return PlatformApple( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - bundleIdentifier: map['bundleIdentifier'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "bundleIdentifier": bundleIdentifier, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Apple bundle identifier. + final String bundleIdentifier; + + PlatformApple({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.bundleIdentifier, + }); + + factory PlatformApple.fromMap(Map map) { + return PlatformApple( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + bundleIdentifier: map['bundleIdentifier'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "bundleIdentifier": bundleIdentifier, + }; + } } diff --git a/lib/src/models/platform_linux.dart b/lib/src/models/platform_linux.dart index 45131dde..e59803d2 100644 --- a/lib/src/models/platform_linux.dart +++ b/lib/src/models/platform_linux.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Linux class PlatformLinux implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Linux package name. - final String packageName; - - PlatformLinux({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.packageName, - }); - - factory PlatformLinux.fromMap(Map map) { - return PlatformLinux( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - packageName: map['packageName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "packageName": packageName, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Linux package name. + final String packageName; + + PlatformLinux({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.packageName, + }); + + factory PlatformLinux.fromMap(Map map) { + return PlatformLinux( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + packageName: map['packageName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "packageName": packageName, + }; + } } diff --git a/lib/src/models/platform_list.dart b/lib/src/models/platform_list.dart index 1c5f8b02..9d099793 100644 --- a/lib/src/models/platform_list.dart +++ b/lib/src/models/platform_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Platforms List class PlatformList implements Model { - /// Total number of platforms in the given project. - final int total; + /// Total number of platforms in the given project. + final int total; - /// List of platforms. - final List platforms; + /// List of platforms. + final List platforms; - PlatformList({ - required this.total, - required this.platforms, - }); + PlatformList({ + required this.total, + required this.platforms, + }); - factory PlatformList.fromMap(Map map) { - return PlatformList( - total: map['total'], - platforms: List.from(map['platforms'] ?? []), - ); - } + factory PlatformList.fromMap(Map map) { + return PlatformList( + total: map['total'], + platforms: List.from(map['platforms'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "platforms": platforms, - }; - } + @override + Map toMap() { + return { + "total": total, + "platforms": platforms, + }; + } } diff --git a/lib/src/models/platform_web.dart b/lib/src/models/platform_web.dart index 630225df..e4de0941 100644 --- a/lib/src/models/platform_web.dart +++ b/lib/src/models/platform_web.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Web class PlatformWeb implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Web app hostname. Empty string for other platforms. - final String hostname; - - PlatformWeb({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.hostname, - }); - - factory PlatformWeb.fromMap(Map map) { - return PlatformWeb( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - hostname: map['hostname'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "hostname": hostname, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Web app hostname. Empty string for other platforms. + final String hostname; + + PlatformWeb({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.hostname, + }); + + factory PlatformWeb.fromMap(Map map) { + return PlatformWeb( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + hostname: map['hostname'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "hostname": hostname, + }; + } } diff --git a/lib/src/models/platform_windows.dart b/lib/src/models/platform_windows.dart index 957533a4..1e7c121a 100644 --- a/lib/src/models/platform_windows.dart +++ b/lib/src/models/platform_windows.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Windows class PlatformWindows implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Windows package identifier name. - final String packageIdentifierName; - - PlatformWindows({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.packageIdentifierName, - }); - - factory PlatformWindows.fromMap(Map map) { - return PlatformWindows( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - packageIdentifierName: map['packageIdentifierName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "packageIdentifierName": packageIdentifierName, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Windows package identifier name. + final String packageIdentifierName; + + PlatformWindows({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.packageIdentifierName, + }); + + factory PlatformWindows.fromMap(Map map) { + return PlatformWindows( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + packageIdentifierName: map['packageIdentifierName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "packageIdentifierName": packageIdentifierName, + }; + } } diff --git a/lib/src/models/policy_list.dart b/lib/src/models/policy_list.dart new file mode 100644 index 00000000..6443a439 --- /dev/null +++ b/lib/src/models/policy_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policies List +class PolicyList implements Model { + /// Total number of policies in the given project. + final int total; + + /// List of policies. + final List policies; + + PolicyList({ + required this.total, + required this.policies, + }); + + factory PolicyList.fromMap(Map map) { + return PolicyList( + total: map['total'], + policies: List.from(map['policies'] ?? []), + ); + } + + @override + Map toMap() { + return { + "total": total, + "policies": policies, + }; + } +} diff --git a/lib/src/models/policy_membership_privacy.dart b/lib/src/models/policy_membership_privacy.dart new file mode 100644 index 00000000..8fadbbca --- /dev/null +++ b/lib/src/models/policy_membership_privacy.dart @@ -0,0 +1,54 @@ +part of '../../models.dart'; + +/// Policy Membership Privacy +class PolicyMembershipPrivacy implements Model { + /// Policy ID. + final String $id; + + /// Whether user ID is visible in memberships. + final bool userId; + + /// Whether user email is visible in memberships. + final bool userEmail; + + /// Whether user phone is visible in memberships. + final bool userPhone; + + /// Whether user name is visible in memberships. + final bool userName; + + /// Whether user MFA status is visible in memberships. + final bool userMFA; + + PolicyMembershipPrivacy({ + required this.$id, + required this.userId, + required this.userEmail, + required this.userPhone, + required this.userName, + required this.userMFA, + }); + + factory PolicyMembershipPrivacy.fromMap(Map map) { + return PolicyMembershipPrivacy( + $id: map['\$id'].toString(), + userId: map['userId'], + userEmail: map['userEmail'], + userPhone: map['userPhone'], + userName: map['userName'], + userMFA: map['userMFA'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "userId": userId, + "userEmail": userEmail, + "userPhone": userPhone, + "userName": userName, + "userMFA": userMFA, + }; + } +} diff --git a/lib/src/models/policy_password_dictionary.dart b/lib/src/models/policy_password_dictionary.dart new file mode 100644 index 00000000..7ad863b3 --- /dev/null +++ b/lib/src/models/policy_password_dictionary.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Password Dictionary +class PolicyPasswordDictionary implements Model { + /// Policy ID. + final String $id; + + /// Whether password dictionary policy is enabled. + final bool enabled; + + PolicyPasswordDictionary({ + required this.$id, + required this.enabled, + }); + + factory PolicyPasswordDictionary.fromMap(Map map) { + return PolicyPasswordDictionary( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_password_history.dart b/lib/src/models/policy_password_history.dart new file mode 100644 index 00000000..fa9a350e --- /dev/null +++ b/lib/src/models/policy_password_history.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Password History +class PolicyPasswordHistory implements Model { + /// Policy ID. + final String $id; + + /// Password history length. A value of 0 means the policy is disabled. + final int total; + + PolicyPasswordHistory({ + required this.$id, + required this.total, + }); + + factory PolicyPasswordHistory.fromMap(Map map) { + return PolicyPasswordHistory( + $id: map['\$id'].toString(), + total: map['total'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } +} diff --git a/lib/src/models/policy_password_personal_data.dart b/lib/src/models/policy_password_personal_data.dart new file mode 100644 index 00000000..5fe4791d --- /dev/null +++ b/lib/src/models/policy_password_personal_data.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Password Personal Data +class PolicyPasswordPersonalData implements Model { + /// Policy ID. + final String $id; + + /// Whether password personal data policy is enabled. + final bool enabled; + + PolicyPasswordPersonalData({ + required this.$id, + required this.enabled, + }); + + factory PolicyPasswordPersonalData.fromMap(Map map) { + return PolicyPasswordPersonalData( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_session_alert.dart b/lib/src/models/policy_session_alert.dart new file mode 100644 index 00000000..9b5e4d03 --- /dev/null +++ b/lib/src/models/policy_session_alert.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Alert +class PolicySessionAlert implements Model { + /// Policy ID. + final String $id; + + /// Whether session alert policy is enabled. + final bool enabled; + + PolicySessionAlert({ + required this.$id, + required this.enabled, + }); + + factory PolicySessionAlert.fromMap(Map map) { + return PolicySessionAlert( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_session_duration.dart b/lib/src/models/policy_session_duration.dart new file mode 100644 index 00000000..4cc81d0c --- /dev/null +++ b/lib/src/models/policy_session_duration.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Duration +class PolicySessionDuration implements Model { + /// Policy ID. + final String $id; + + /// Session duration in seconds. + final int duration; + + PolicySessionDuration({ + required this.$id, + required this.duration, + }); + + factory PolicySessionDuration.fromMap(Map map) { + return PolicySessionDuration( + $id: map['\$id'].toString(), + duration: map['duration'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "duration": duration, + }; + } +} diff --git a/lib/src/models/policy_session_invalidation.dart b/lib/src/models/policy_session_invalidation.dart new file mode 100644 index 00000000..4e33078d --- /dev/null +++ b/lib/src/models/policy_session_invalidation.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Invalidation +class PolicySessionInvalidation implements Model { + /// Policy ID. + final String $id; + + /// Whether session invalidation policy is enabled. + final bool enabled; + + PolicySessionInvalidation({ + required this.$id, + required this.enabled, + }); + + factory PolicySessionInvalidation.fromMap(Map map) { + return PolicySessionInvalidation( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } +} diff --git a/lib/src/models/policy_session_limit.dart b/lib/src/models/policy_session_limit.dart new file mode 100644 index 00000000..419ac303 --- /dev/null +++ b/lib/src/models/policy_session_limit.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy Session Limit +class PolicySessionLimit implements Model { + /// Policy ID. + final String $id; + + /// Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. + final int total; + + PolicySessionLimit({ + required this.$id, + required this.total, + }); + + factory PolicySessionLimit.fromMap(Map map) { + return PolicySessionLimit( + $id: map['\$id'].toString(), + total: map['total'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } +} diff --git a/lib/src/models/policy_user_limit.dart b/lib/src/models/policy_user_limit.dart new file mode 100644 index 00000000..6436c4e2 --- /dev/null +++ b/lib/src/models/policy_user_limit.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Policy User Limit +class PolicyUserLimit implements Model { + /// Policy ID. + final String $id; + + /// Maximum number of users allowed in the project. A value of 0 means the policy is disabled. + final int total; + + PolicyUserLimit({ + required this.$id, + required this.total, + }); + + factory PolicyUserLimit.fromMap(Map map) { + return PolicyUserLimit( + $id: map['\$id'].toString(), + total: map['total'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } +} diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index 3ca04118..b107afe5 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,24 +2,24 @@ part of '../../models.dart'; /// Preferences class Preferences implements Model { - final Map data; + final Map data; - Preferences({ - required this.data, - }); + Preferences({ + required this.data, + }); - factory Preferences.fromMap(Map map) { - return Preferences( - data: map["data"] ?? map, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "data": data, - }; - } + @override + Map toMap() { + return { + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/presence.dart b/lib/src/models/presence.dart new file mode 100644 index 00000000..19c5f285 --- /dev/null +++ b/lib/src/models/presence.dart @@ -0,0 +1,85 @@ +part of '../../models.dart'; + +/// Presence +class Presence implements Model { + /// Presence ID. + final String $id; + + /// Presence sequence ID. + final String $sequence; + + /// Presence creation date in ISO 8601 format. + final String $createdAt; + + /// Presence update date in ISO 8601 format. + final String $updatedAt; + + /// Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// User internal ID. + final String userInternalId; + + /// User ID. + final String userId; + + /// Presence status. + final String? status; + + /// Presence source. + final String source; + + /// Presence expiry date in ISO 8601 format. + final String? expiresAt; + + final Map data; + + Presence({ + required this.$id, + required this.$sequence, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.userInternalId, + required this.userId, + this.status, + required this.source, + this.expiresAt, + required this.data, + }); + + factory Presence.fromMap(Map map) { + return Presence( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + userInternalId: map['userInternalId'].toString(), + userId: map['userId'].toString(), + status: map['status']?.toString(), + source: map['source'].toString(), + expiresAt: map['expiresAt']?.toString(), + data: map["data"] ?? map, + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "userInternalId": userInternalId, + "userId": userId, + "status": status, + "source": source, + "expiresAt": expiresAt, + "data": data, + }; + } + + T convertTo(T Function(Map) fromJson) => fromJson(data); +} diff --git a/lib/src/models/presence_list.dart b/lib/src/models/presence_list.dart new file mode 100644 index 00000000..9c56ed41 --- /dev/null +++ b/lib/src/models/presence_list.dart @@ -0,0 +1,33 @@ +part of '../../models.dart'; + +/// Presences List +class PresenceList implements Model { + /// Total number of presences that matched your query. + final int total; + + /// List of presences. + final List presences; + + PresenceList({ + required this.total, + required this.presences, + }); + + factory PresenceList.fromMap(Map map) { + return PresenceList( + total: map['total'], + presences: List.from(map['presences'].map((p) => Presence.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "presences": presences.map((p) => p.toMap()).toList(), + }; + } + + List convertTo(T Function(Map) fromJson) => + presences.map((d) => d.convertTo(fromJson)).toList(); +} diff --git a/lib/src/models/project.dart b/lib/src/models/project.dart index 10f84064..186f1c79 100644 --- a/lib/src/models/project.dart +++ b/lib/src/models/project.dart @@ -2,488 +2,503 @@ part of '../../models.dart'; /// Project class Project implements Model { - /// Project ID. - final String $id; + /// Project ID. + final String $id; - /// Project creation date in ISO 8601 format. - final String $createdAt; + /// Project creation date in ISO 8601 format. + final String $createdAt; - /// Project update date in ISO 8601 format. - final String $updatedAt; + /// Project update date in ISO 8601 format. + final String $updatedAt; - /// Project name. - final String name; + /// Project name. + final String name; - /// Project description. - final String description; + /// Project description. + final String description; - /// Project team ID. - final String teamId; + /// Project team ID. + final String teamId; - /// Project logo file ID. - final String logo; + /// Project logo file ID. + final String logo; - /// Project website URL. - final String url; + /// Project website URL. + final String url; - /// Company legal name. - final String legalName; + /// Company legal name. + final String legalName; - /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. - final String legalCountry; + /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. + final String legalCountry; - /// State name. - final String legalState; + /// State name. + final String legalState; - /// City name. - final String legalCity; + /// City name. + final String legalCity; - /// Company Address. - final String legalAddress; + /// Company Address. + final String legalAddress; - /// Company Tax ID. - final String legalTaxId; + /// Company Tax ID. + final String legalTaxId; - /// Session duration in seconds. - final int authDuration; + /// Session duration in seconds. + final int authDuration; - /// Max users allowed. 0 is unlimited. - final int authLimit; + /// Max users allowed. 0 is unlimited. + final int authLimit; - /// Max sessions allowed per user. 100 maximum. - final int authSessionsLimit; + /// Max sessions allowed per user. 100 maximum. + final int authSessionsLimit; - /// Max allowed passwords in the history list per user. Max passwords limit allowed in history is 20. Use 0 for disabling password history. - final int authPasswordHistory; + /// Max allowed passwords in the history list per user. Max passwords limit allowed in history is 20. Use 0 for disabling password history. + final int authPasswordHistory; - /// Whether or not to check user's password against most commonly used passwords. - final bool authPasswordDictionary; + /// Whether or not to check user's password against most commonly used passwords. + final bool authPasswordDictionary; - /// Whether or not to check the user password for similarity with their personal data. - final bool authPersonalDataCheck; + /// Whether or not to check the user password for similarity with their personal data. + final bool authPersonalDataCheck; - /// Whether or not to disallow disposable email addresses during signup and email updates. - final bool authDisposableEmails; + /// Whether or not to disallow disposable email addresses during signup and email updates. + final bool authDisposableEmails; - /// Whether or not to require canonical email addresses during signup and email updates. - final bool authCanonicalEmails; + /// Whether or not to require canonical email addresses during signup and email updates. + final bool authCanonicalEmails; - /// Whether or not to disallow free email addresses during signup and email updates. - final bool authFreeEmails; + /// Whether or not to disallow free email addresses during signup and email updates. + final bool authFreeEmails; - /// An array of mock numbers and their corresponding verification codes (OTPs). - final List authMockNumbers; + /// An array of mock numbers and their corresponding verification codes (OTPs). + final List authMockNumbers; - /// Whether or not to send session alert emails to users. - final bool authSessionAlerts; + /// Whether or not to send session alert emails to users. + final bool authSessionAlerts; - /// Whether or not to show user names in the teams membership response. - final bool authMembershipsUserName; + /// Whether or not to show user names in the teams membership response. + final bool authMembershipsUserName; - /// Whether or not to show user emails in the teams membership response. - final bool authMembershipsUserEmail; + /// Whether or not to show user emails in the teams membership response. + final bool authMembershipsUserEmail; - /// Whether or not to show user MFA status in the teams membership response. - final bool authMembershipsMfa; + /// Whether or not to show user MFA status in the teams membership response. + final bool authMembershipsMfa; - /// Whether or not all existing sessions should be invalidated on password change - final bool authInvalidateSessions; + /// Whether or not to show user IDs in the teams membership response. + final bool authMembershipsUserId; - /// List of Auth Providers. - final List oAuthProviders; + /// Whether or not to show user phone numbers in the teams membership response. + final bool authMembershipsUserPhone; - /// List of Platforms. - final List platforms; + /// Whether or not all existing sessions should be invalidated on password change + final bool authInvalidateSessions; - /// List of Webhooks. - final List webhooks; + /// List of Auth Providers. + final List oAuthProviders; - /// List of API Keys. - final List keys; + /// List of Platforms. + final List platforms; - /// List of dev keys. - final List devKeys; + /// List of Webhooks. + final List webhooks; - /// Status for custom SMTP - final bool smtpEnabled; + /// List of API Keys. + final List keys; - /// SMTP sender name - final String smtpSenderName; + /// List of dev keys. + final List devKeys; - /// SMTP sender email - final String smtpSenderEmail; + /// Status for custom SMTP + final bool smtpEnabled; - /// SMTP reply to email - final String smtpReplyTo; + /// SMTP sender name + final String smtpSenderName; - /// SMTP server host name - final String smtpHost; + /// SMTP sender email + final String smtpSenderEmail; - /// SMTP server port - final int smtpPort; + /// SMTP reply to name + final String smtpReplyToName; - /// SMTP server username - final String smtpUsername; + /// SMTP reply to email + final String smtpReplyToEmail; - /// SMTP server password - final String smtpPassword; + /// SMTP server host name + final String smtpHost; - /// SMTP server secure protocol - final String smtpSecure; + /// SMTP server port + final int smtpPort; - /// Number of times the ping was received for this project. - final int pingCount; + /// SMTP server username + final String smtpUsername; - /// Last ping datetime in ISO 8601 format. - final String pingedAt; + /// SMTP server password. This property is write-only and always returned empty. + final String smtpPassword; - /// Labels for the project. - final List labels; + /// SMTP server secure protocol + final String smtpSecure; - /// Project status - final String status; + /// Number of times the ping was received for this project. + final int pingCount; - /// Email/Password auth method status - final bool authEmailPassword; + /// Last ping datetime in ISO 8601 format. + final String pingedAt; - /// Magic URL auth method status - final bool authUsersAuthMagicURL; + /// Labels for the project. + final List labels; - /// Email (OTP) auth method status - final bool authEmailOtp; + /// Project status + final String status; - /// Anonymous auth method status - final bool authAnonymous; + /// Email/Password auth method status + final bool authEmailPassword; - /// Invites auth method status - final bool authInvites; + /// Magic URL auth method status + final bool authUsersAuthMagicURL; - /// JWT auth method status - final bool authJWT; + /// Email (OTP) auth method status + final bool authEmailOtp; - /// Phone auth method status - final bool authPhone; + /// Anonymous auth method status + final bool authAnonymous; - /// Account service status - final bool serviceStatusForAccount; + /// Invites auth method status + final bool authInvites; - /// Avatars service status - final bool serviceStatusForAvatars; + /// JWT auth method status + final bool authJWT; - /// Databases (legacy) service status - final bool serviceStatusForDatabases; + /// Phone auth method status + final bool authPhone; - /// TablesDB service status - final bool serviceStatusForTablesdb; + /// Account service status + final bool serviceStatusForAccount; - /// Locale service status - final bool serviceStatusForLocale; + /// Avatars service status + final bool serviceStatusForAvatars; - /// Health service status - final bool serviceStatusForHealth; + /// Databases (legacy) service status + final bool serviceStatusForDatabases; - /// Project service status - final bool serviceStatusForProject; + /// TablesDB service status + final bool serviceStatusForTablesdb; - /// Storage service status - final bool serviceStatusForStorage; + /// Locale service status + final bool serviceStatusForLocale; - /// Teams service status - final bool serviceStatusForTeams; - - /// Users service status - final bool serviceStatusForUsers; - - /// VCS service status - final bool serviceStatusForVcs; - - /// Sites service status - final bool serviceStatusForSites; - - /// Functions service status - final bool serviceStatusForFunctions; - - /// Proxy service status - final bool serviceStatusForProxy; - - /// GraphQL service status - final bool serviceStatusForGraphql; - - /// Migrations service status - final bool serviceStatusForMigrations; - - /// Messaging service status - final bool serviceStatusForMessaging; - - /// REST protocol status - final bool protocolStatusForRest; - - /// GraphQL protocol status - final bool protocolStatusForGraphql; - - /// Websocket protocol status - final bool protocolStatusForWebsocket; - - /// Project region - final String region; - - /// Billing limits reached - final BillingLimits billingLimits; - - /// Project blocks information - final List blocks; - - /// Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. - final String consoleAccessedAt; - - Project({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.description, - required this.teamId, - required this.logo, - required this.url, - required this.legalName, - required this.legalCountry, - required this.legalState, - required this.legalCity, - required this.legalAddress, - required this.legalTaxId, - required this.authDuration, - required this.authLimit, - required this.authSessionsLimit, - required this.authPasswordHistory, - required this.authPasswordDictionary, - required this.authPersonalDataCheck, - required this.authDisposableEmails, - required this.authCanonicalEmails, - required this.authFreeEmails, - required this.authMockNumbers, - required this.authSessionAlerts, - required this.authMembershipsUserName, - required this.authMembershipsUserEmail, - required this.authMembershipsMfa, - required this.authInvalidateSessions, - required this.oAuthProviders, - required this.platforms, - required this.webhooks, - required this.keys, - required this.devKeys, - required this.smtpEnabled, - required this.smtpSenderName, - required this.smtpSenderEmail, - required this.smtpReplyTo, - required this.smtpHost, - required this.smtpPort, - required this.smtpUsername, - required this.smtpPassword, - required this.smtpSecure, - required this.pingCount, - required this.pingedAt, - required this.labels, - required this.status, - required this.authEmailPassword, - required this.authUsersAuthMagicURL, - required this.authEmailOtp, - required this.authAnonymous, - required this.authInvites, - required this.authJWT, - required this.authPhone, - required this.serviceStatusForAccount, - required this.serviceStatusForAvatars, - required this.serviceStatusForDatabases, - required this.serviceStatusForTablesdb, - required this.serviceStatusForLocale, - required this.serviceStatusForHealth, - required this.serviceStatusForProject, - required this.serviceStatusForStorage, - required this.serviceStatusForTeams, - required this.serviceStatusForUsers, - required this.serviceStatusForVcs, - required this.serviceStatusForSites, - required this.serviceStatusForFunctions, - required this.serviceStatusForProxy, - required this.serviceStatusForGraphql, - required this.serviceStatusForMigrations, - required this.serviceStatusForMessaging, - required this.protocolStatusForRest, - required this.protocolStatusForGraphql, - required this.protocolStatusForWebsocket, - required this.region, - required this.billingLimits, - required this.blocks, - required this.consoleAccessedAt, - }); - - factory Project.fromMap(Map map) { - return Project( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - description: map['description'].toString(), - teamId: map['teamId'].toString(), - logo: map['logo'].toString(), - url: map['url'].toString(), - legalName: map['legalName'].toString(), - legalCountry: map['legalCountry'].toString(), - legalState: map['legalState'].toString(), - legalCity: map['legalCity'].toString(), - legalAddress: map['legalAddress'].toString(), - legalTaxId: map['legalTaxId'].toString(), - authDuration: map['authDuration'], - authLimit: map['authLimit'], - authSessionsLimit: map['authSessionsLimit'], - authPasswordHistory: map['authPasswordHistory'], - authPasswordDictionary: map['authPasswordDictionary'], - authPersonalDataCheck: map['authPersonalDataCheck'], - authDisposableEmails: map['authDisposableEmails'], - authCanonicalEmails: map['authCanonicalEmails'], - authFreeEmails: map['authFreeEmails'], - authMockNumbers: List.from( - map['authMockNumbers'].map((p) => MockNumber.fromMap(p))), - authSessionAlerts: map['authSessionAlerts'], - authMembershipsUserName: map['authMembershipsUserName'], - authMembershipsUserEmail: map['authMembershipsUserEmail'], - authMembershipsMfa: map['authMembershipsMfa'], - authInvalidateSessions: map['authInvalidateSessions'], - oAuthProviders: List.from( - map['oAuthProviders'].map((p) => AuthProvider.fromMap(p))), - platforms: List.from(map['platforms'] ?? []), - webhooks: - List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), - keys: List.from(map['keys'].map((p) => Key.fromMap(p))), - devKeys: List.from(map['devKeys'].map((p) => DevKey.fromMap(p))), - smtpEnabled: map['smtpEnabled'], - smtpSenderName: map['smtpSenderName'].toString(), - smtpSenderEmail: map['smtpSenderEmail'].toString(), - smtpReplyTo: map['smtpReplyTo'].toString(), - smtpHost: map['smtpHost'].toString(), - smtpPort: map['smtpPort'], - smtpUsername: map['smtpUsername'].toString(), - smtpPassword: map['smtpPassword'].toString(), - smtpSecure: map['smtpSecure'].toString(), - pingCount: map['pingCount'], - pingedAt: map['pingedAt'].toString(), - labels: List.from(map['labels'] ?? []), - status: map['status'].toString(), - authEmailPassword: map['authEmailPassword'], - authUsersAuthMagicURL: map['authUsersAuthMagicURL'], - authEmailOtp: map['authEmailOtp'], - authAnonymous: map['authAnonymous'], - authInvites: map['authInvites'], - authJWT: map['authJWT'], - authPhone: map['authPhone'], - serviceStatusForAccount: map['serviceStatusForAccount'], - serviceStatusForAvatars: map['serviceStatusForAvatars'], - serviceStatusForDatabases: map['serviceStatusForDatabases'], - serviceStatusForTablesdb: map['serviceStatusForTablesdb'], - serviceStatusForLocale: map['serviceStatusForLocale'], - serviceStatusForHealth: map['serviceStatusForHealth'], - serviceStatusForProject: map['serviceStatusForProject'], - serviceStatusForStorage: map['serviceStatusForStorage'], - serviceStatusForTeams: map['serviceStatusForTeams'], - serviceStatusForUsers: map['serviceStatusForUsers'], - serviceStatusForVcs: map['serviceStatusForVcs'], - serviceStatusForSites: map['serviceStatusForSites'], - serviceStatusForFunctions: map['serviceStatusForFunctions'], - serviceStatusForProxy: map['serviceStatusForProxy'], - serviceStatusForGraphql: map['serviceStatusForGraphql'], - serviceStatusForMigrations: map['serviceStatusForMigrations'], - serviceStatusForMessaging: map['serviceStatusForMessaging'], - protocolStatusForRest: map['protocolStatusForRest'], - protocolStatusForGraphql: map['protocolStatusForGraphql'], - protocolStatusForWebsocket: map['protocolStatusForWebsocket'], - region: map['region'].toString(), - billingLimits: BillingLimits.fromMap(map['billingLimits']), - blocks: List.from(map['blocks'].map((p) => Block.fromMap(p))), - consoleAccessedAt: map['consoleAccessedAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "description": description, - "teamId": teamId, - "logo": logo, - "url": url, - "legalName": legalName, - "legalCountry": legalCountry, - "legalState": legalState, - "legalCity": legalCity, - "legalAddress": legalAddress, - "legalTaxId": legalTaxId, - "authDuration": authDuration, - "authLimit": authLimit, - "authSessionsLimit": authSessionsLimit, - "authPasswordHistory": authPasswordHistory, - "authPasswordDictionary": authPasswordDictionary, - "authPersonalDataCheck": authPersonalDataCheck, - "authDisposableEmails": authDisposableEmails, - "authCanonicalEmails": authCanonicalEmails, - "authFreeEmails": authFreeEmails, - "authMockNumbers": authMockNumbers.map((p) => p.toMap()).toList(), - "authSessionAlerts": authSessionAlerts, - "authMembershipsUserName": authMembershipsUserName, - "authMembershipsUserEmail": authMembershipsUserEmail, - "authMembershipsMfa": authMembershipsMfa, - "authInvalidateSessions": authInvalidateSessions, - "oAuthProviders": oAuthProviders.map((p) => p.toMap()).toList(), - "platforms": platforms, - "webhooks": webhooks.map((p) => p.toMap()).toList(), - "keys": keys.map((p) => p.toMap()).toList(), - "devKeys": devKeys.map((p) => p.toMap()).toList(), - "smtpEnabled": smtpEnabled, - "smtpSenderName": smtpSenderName, - "smtpSenderEmail": smtpSenderEmail, - "smtpReplyTo": smtpReplyTo, - "smtpHost": smtpHost, - "smtpPort": smtpPort, - "smtpUsername": smtpUsername, - "smtpPassword": smtpPassword, - "smtpSecure": smtpSecure, - "pingCount": pingCount, - "pingedAt": pingedAt, - "labels": labels, - "status": status, - "authEmailPassword": authEmailPassword, - "authUsersAuthMagicURL": authUsersAuthMagicURL, - "authEmailOtp": authEmailOtp, - "authAnonymous": authAnonymous, - "authInvites": authInvites, - "authJWT": authJWT, - "authPhone": authPhone, - "serviceStatusForAccount": serviceStatusForAccount, - "serviceStatusForAvatars": serviceStatusForAvatars, - "serviceStatusForDatabases": serviceStatusForDatabases, - "serviceStatusForTablesdb": serviceStatusForTablesdb, - "serviceStatusForLocale": serviceStatusForLocale, - "serviceStatusForHealth": serviceStatusForHealth, - "serviceStatusForProject": serviceStatusForProject, - "serviceStatusForStorage": serviceStatusForStorage, - "serviceStatusForTeams": serviceStatusForTeams, - "serviceStatusForUsers": serviceStatusForUsers, - "serviceStatusForVcs": serviceStatusForVcs, - "serviceStatusForSites": serviceStatusForSites, - "serviceStatusForFunctions": serviceStatusForFunctions, - "serviceStatusForProxy": serviceStatusForProxy, - "serviceStatusForGraphql": serviceStatusForGraphql, - "serviceStatusForMigrations": serviceStatusForMigrations, - "serviceStatusForMessaging": serviceStatusForMessaging, - "protocolStatusForRest": protocolStatusForRest, - "protocolStatusForGraphql": protocolStatusForGraphql, - "protocolStatusForWebsocket": protocolStatusForWebsocket, - "region": region, - "billingLimits": billingLimits.toMap(), - "blocks": blocks.map((p) => p.toMap()).toList(), - "consoleAccessedAt": consoleAccessedAt, - }; - } + /// Health service status + final bool serviceStatusForHealth; + + /// Project service status + final bool serviceStatusForProject; + + /// Storage service status + final bool serviceStatusForStorage; + + /// Teams service status + final bool serviceStatusForTeams; + + /// Users service status + final bool serviceStatusForUsers; + + /// VCS service status + final bool serviceStatusForVcs; + + /// Sites service status + final bool serviceStatusForSites; + + /// Functions service status + final bool serviceStatusForFunctions; + + /// Proxy service status + final bool serviceStatusForProxy; + + /// GraphQL service status + final bool serviceStatusForGraphql; + + /// Migrations service status + final bool serviceStatusForMigrations; + + /// Messaging service status + final bool serviceStatusForMessaging; + + /// REST protocol status + final bool protocolStatusForRest; + + /// GraphQL protocol status + final bool protocolStatusForGraphql; + + /// Websocket protocol status + final bool protocolStatusForWebsocket; + + /// Project region + final String region; + + /// Billing limits reached + final BillingLimits billingLimits; + + /// Project blocks information + final List blocks; + + /// Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + final String consoleAccessedAt; + + Project({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.description, + required this.teamId, + required this.logo, + required this.url, + required this.legalName, + required this.legalCountry, + required this.legalState, + required this.legalCity, + required this.legalAddress, + required this.legalTaxId, + required this.authDuration, + required this.authLimit, + required this.authSessionsLimit, + required this.authPasswordHistory, + required this.authPasswordDictionary, + required this.authPersonalDataCheck, + required this.authDisposableEmails, + required this.authCanonicalEmails, + required this.authFreeEmails, + required this.authMockNumbers, + required this.authSessionAlerts, + required this.authMembershipsUserName, + required this.authMembershipsUserEmail, + required this.authMembershipsMfa, + required this.authMembershipsUserId, + required this.authMembershipsUserPhone, + required this.authInvalidateSessions, + required this.oAuthProviders, + required this.platforms, + required this.webhooks, + required this.keys, + required this.devKeys, + required this.smtpEnabled, + required this.smtpSenderName, + required this.smtpSenderEmail, + required this.smtpReplyToName, + required this.smtpReplyToEmail, + required this.smtpHost, + required this.smtpPort, + required this.smtpUsername, + required this.smtpPassword, + required this.smtpSecure, + required this.pingCount, + required this.pingedAt, + required this.labels, + required this.status, + required this.authEmailPassword, + required this.authUsersAuthMagicURL, + required this.authEmailOtp, + required this.authAnonymous, + required this.authInvites, + required this.authJWT, + required this.authPhone, + required this.serviceStatusForAccount, + required this.serviceStatusForAvatars, + required this.serviceStatusForDatabases, + required this.serviceStatusForTablesdb, + required this.serviceStatusForLocale, + required this.serviceStatusForHealth, + required this.serviceStatusForProject, + required this.serviceStatusForStorage, + required this.serviceStatusForTeams, + required this.serviceStatusForUsers, + required this.serviceStatusForVcs, + required this.serviceStatusForSites, + required this.serviceStatusForFunctions, + required this.serviceStatusForProxy, + required this.serviceStatusForGraphql, + required this.serviceStatusForMigrations, + required this.serviceStatusForMessaging, + required this.protocolStatusForRest, + required this.protocolStatusForGraphql, + required this.protocolStatusForWebsocket, + required this.region, + required this.billingLimits, + required this.blocks, + required this.consoleAccessedAt, + }); + + factory Project.fromMap(Map map) { + return Project( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + description: map['description'].toString(), + teamId: map['teamId'].toString(), + logo: map['logo'].toString(), + url: map['url'].toString(), + legalName: map['legalName'].toString(), + legalCountry: map['legalCountry'].toString(), + legalState: map['legalState'].toString(), + legalCity: map['legalCity'].toString(), + legalAddress: map['legalAddress'].toString(), + legalTaxId: map['legalTaxId'].toString(), + authDuration: map['authDuration'], + authLimit: map['authLimit'], + authSessionsLimit: map['authSessionsLimit'], + authPasswordHistory: map['authPasswordHistory'], + authPasswordDictionary: map['authPasswordDictionary'], + authPersonalDataCheck: map['authPersonalDataCheck'], + authDisposableEmails: map['authDisposableEmails'], + authCanonicalEmails: map['authCanonicalEmails'], + authFreeEmails: map['authFreeEmails'], + authMockNumbers: List.from(map['authMockNumbers'].map((p) => MockNumber.fromMap(p))), + authSessionAlerts: map['authSessionAlerts'], + authMembershipsUserName: map['authMembershipsUserName'], + authMembershipsUserEmail: map['authMembershipsUserEmail'], + authMembershipsMfa: map['authMembershipsMfa'], + authMembershipsUserId: map['authMembershipsUserId'], + authMembershipsUserPhone: map['authMembershipsUserPhone'], + authInvalidateSessions: map['authInvalidateSessions'], + oAuthProviders: List.from(map['oAuthProviders'].map((p) => AuthProvider.fromMap(p))), + platforms: List.from(map['platforms'] ?? []), + webhooks: List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), + keys: List.from(map['keys'].map((p) => Key.fromMap(p))), + devKeys: List.from(map['devKeys'].map((p) => DevKey.fromMap(p))), + smtpEnabled: map['smtpEnabled'], + smtpSenderName: map['smtpSenderName'].toString(), + smtpSenderEmail: map['smtpSenderEmail'].toString(), + smtpReplyToName: map['smtpReplyToName'].toString(), + smtpReplyToEmail: map['smtpReplyToEmail'].toString(), + smtpHost: map['smtpHost'].toString(), + smtpPort: map['smtpPort'], + smtpUsername: map['smtpUsername'].toString(), + smtpPassword: map['smtpPassword'].toString(), + smtpSecure: map['smtpSecure'].toString(), + pingCount: map['pingCount'], + pingedAt: map['pingedAt'].toString(), + labels: List.from(map['labels'] ?? []), + status: map['status'].toString(), + authEmailPassword: map['authEmailPassword'], + authUsersAuthMagicURL: map['authUsersAuthMagicURL'], + authEmailOtp: map['authEmailOtp'], + authAnonymous: map['authAnonymous'], + authInvites: map['authInvites'], + authJWT: map['authJWT'], + authPhone: map['authPhone'], + serviceStatusForAccount: map['serviceStatusForAccount'], + serviceStatusForAvatars: map['serviceStatusForAvatars'], + serviceStatusForDatabases: map['serviceStatusForDatabases'], + serviceStatusForTablesdb: map['serviceStatusForTablesdb'], + serviceStatusForLocale: map['serviceStatusForLocale'], + serviceStatusForHealth: map['serviceStatusForHealth'], + serviceStatusForProject: map['serviceStatusForProject'], + serviceStatusForStorage: map['serviceStatusForStorage'], + serviceStatusForTeams: map['serviceStatusForTeams'], + serviceStatusForUsers: map['serviceStatusForUsers'], + serviceStatusForVcs: map['serviceStatusForVcs'], + serviceStatusForSites: map['serviceStatusForSites'], + serviceStatusForFunctions: map['serviceStatusForFunctions'], + serviceStatusForProxy: map['serviceStatusForProxy'], + serviceStatusForGraphql: map['serviceStatusForGraphql'], + serviceStatusForMigrations: map['serviceStatusForMigrations'], + serviceStatusForMessaging: map['serviceStatusForMessaging'], + protocolStatusForRest: map['protocolStatusForRest'], + protocolStatusForGraphql: map['protocolStatusForGraphql'], + protocolStatusForWebsocket: map['protocolStatusForWebsocket'], + region: map['region'].toString(), + billingLimits: BillingLimits.fromMap(map['billingLimits']), + blocks: List.from(map['blocks'].map((p) => Block.fromMap(p))), + consoleAccessedAt: map['consoleAccessedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "description": description, + "teamId": teamId, + "logo": logo, + "url": url, + "legalName": legalName, + "legalCountry": legalCountry, + "legalState": legalState, + "legalCity": legalCity, + "legalAddress": legalAddress, + "legalTaxId": legalTaxId, + "authDuration": authDuration, + "authLimit": authLimit, + "authSessionsLimit": authSessionsLimit, + "authPasswordHistory": authPasswordHistory, + "authPasswordDictionary": authPasswordDictionary, + "authPersonalDataCheck": authPersonalDataCheck, + "authDisposableEmails": authDisposableEmails, + "authCanonicalEmails": authCanonicalEmails, + "authFreeEmails": authFreeEmails, + "authMockNumbers": authMockNumbers.map((p) => p.toMap()).toList(), + "authSessionAlerts": authSessionAlerts, + "authMembershipsUserName": authMembershipsUserName, + "authMembershipsUserEmail": authMembershipsUserEmail, + "authMembershipsMfa": authMembershipsMfa, + "authMembershipsUserId": authMembershipsUserId, + "authMembershipsUserPhone": authMembershipsUserPhone, + "authInvalidateSessions": authInvalidateSessions, + "oAuthProviders": oAuthProviders.map((p) => p.toMap()).toList(), + "platforms": platforms, + "webhooks": webhooks.map((p) => p.toMap()).toList(), + "keys": keys.map((p) => p.toMap()).toList(), + "devKeys": devKeys.map((p) => p.toMap()).toList(), + "smtpEnabled": smtpEnabled, + "smtpSenderName": smtpSenderName, + "smtpSenderEmail": smtpSenderEmail, + "smtpReplyToName": smtpReplyToName, + "smtpReplyToEmail": smtpReplyToEmail, + "smtpHost": smtpHost, + "smtpPort": smtpPort, + "smtpUsername": smtpUsername, + "smtpPassword": smtpPassword, + "smtpSecure": smtpSecure, + "pingCount": pingCount, + "pingedAt": pingedAt, + "labels": labels, + "status": status, + "authEmailPassword": authEmailPassword, + "authUsersAuthMagicURL": authUsersAuthMagicURL, + "authEmailOtp": authEmailOtp, + "authAnonymous": authAnonymous, + "authInvites": authInvites, + "authJWT": authJWT, + "authPhone": authPhone, + "serviceStatusForAccount": serviceStatusForAccount, + "serviceStatusForAvatars": serviceStatusForAvatars, + "serviceStatusForDatabases": serviceStatusForDatabases, + "serviceStatusForTablesdb": serviceStatusForTablesdb, + "serviceStatusForLocale": serviceStatusForLocale, + "serviceStatusForHealth": serviceStatusForHealth, + "serviceStatusForProject": serviceStatusForProject, + "serviceStatusForStorage": serviceStatusForStorage, + "serviceStatusForTeams": serviceStatusForTeams, + "serviceStatusForUsers": serviceStatusForUsers, + "serviceStatusForVcs": serviceStatusForVcs, + "serviceStatusForSites": serviceStatusForSites, + "serviceStatusForFunctions": serviceStatusForFunctions, + "serviceStatusForProxy": serviceStatusForProxy, + "serviceStatusForGraphql": serviceStatusForGraphql, + "serviceStatusForMigrations": serviceStatusForMigrations, + "serviceStatusForMessaging": serviceStatusForMessaging, + "protocolStatusForRest": protocolStatusForRest, + "protocolStatusForGraphql": protocolStatusForGraphql, + "protocolStatusForWebsocket": protocolStatusForWebsocket, + "region": region, + "billingLimits": billingLimits.toMap(), + "blocks": blocks.map((p) => p.toMap()).toList(), + "consoleAccessedAt": consoleAccessedAt, + }; + } } diff --git a/lib/src/models/provider.dart b/lib/src/models/provider.dart index 98b63a42..016643ca 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Provider class Provider implements Model { - /// Provider ID. - final String $id; + /// Provider ID. + final String $id; - /// Provider creation time in ISO 8601 format. - final String $createdAt; + /// Provider creation time in ISO 8601 format. + final String $createdAt; - /// Provider update date in ISO 8601 format. - final String $updatedAt; + /// Provider update date in ISO 8601 format. + final String $updatedAt; - /// The name for the provider instance. - final String name; + /// The name for the provider instance. + final String name; - /// The name of the provider service. - final String provider; + /// The name of the provider service. + final String provider; - /// Is provider enabled? - final bool enabled; + /// Is provider enabled? + final bool enabled; - /// Type of provider. - final String type; + /// Type of provider. + final String type; - /// Provider credentials. - final Map credentials; + /// Provider credentials. + final Map credentials; - /// Provider options. - final Map? options; + /// Provider options. + final Map? options; - Provider({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.provider, - required this.enabled, - required this.type, - required this.credentials, - this.options, - }); + Provider({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.provider, + required this.enabled, + required this.type, + required this.credentials, + this.options, + }); - factory Provider.fromMap(Map map) { - return Provider( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - provider: map['provider'].toString(), - enabled: map['enabled'], - type: map['type'].toString(), - credentials: map['credentials'], - options: map['options'], - ); - } + factory Provider.fromMap(Map map) { + return Provider( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + provider: map['provider'].toString(), + enabled: map['enabled'], + type: map['type'].toString(), + credentials: map['credentials'], + options: map['options'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "provider": provider, + "enabled": enabled, + "type": type, + "credentials": credentials, + "options": options, + }; + } } diff --git a/lib/src/models/provider_list.dart b/lib/src/models/provider_list.dart index 78085644..f184ef8c 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers that matched your query. - final int total; + /// Total number of providers that matched your query. + final int total; - /// List of providers. - final List providers; + /// List of providers. + final List providers; - ProviderList({ - required this.total, - required this.providers, - }); + ProviderList({ + required this.total, + required this.providers, + }); - factory ProviderList.fromMap(Map map) { - return ProviderList( - total: map['total'], - providers: - List.from(map['providers'].map((p) => Provider.fromMap(p))), - ); - } + factory ProviderList.fromMap(Map map) { + return ProviderList( + total: map['total'], + providers: List.from(map['providers'].map((p) => Provider.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/proxy_rule.dart b/lib/src/models/proxy_rule.dart new file mode 100644 index 00000000..b6bb800e --- /dev/null +++ b/lib/src/models/proxy_rule.dart @@ -0,0 +1,108 @@ +part of '../../models.dart'; + +/// Rule +class ProxyRule implements Model { + /// Rule ID. + final String $id; + + /// Rule creation date in ISO 8601 format. + final String $createdAt; + + /// Rule update date in ISO 8601 format. + final String $updatedAt; + + /// Domain name. + final String domain; + + /// Action definition for the rule. Possible values are "api", "deployment", or "redirect" + final String type; + + /// Defines how the rule was created. Possible values are "manual" or "deployment" + final String trigger; + + /// URL to redirect to. Used if type is "redirect" + final String redirectUrl; + + /// Status code to apply during redirect. Used if type is "redirect" + final int redirectStatusCode; + + /// ID of deployment. Used if type is "deployment" + final String deploymentId; + + /// Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + final enums.ProxyRuleDeploymentResourceType? deploymentResourceType; + + /// ID of deployment's resource (site or function ID). Used if type is "deployment" + final String deploymentResourceId; + + /// Name of Git branch that updates rule. Used if type is "deployment" + final String deploymentVcsProviderBranch; + + /// Domain verification status. Possible values are "unverified", "verifying", "verified" + final enums.ProxyRuleStatus status; + + /// Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. + final String logs; + + /// Certificate auto-renewal date in ISO 8601 format. + final String renewAt; + + ProxyRule({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.domain, + required this.type, + required this.trigger, + required this.redirectUrl, + required this.redirectStatusCode, + required this.deploymentId, + this.deploymentResourceType, + required this.deploymentResourceId, + required this.deploymentVcsProviderBranch, + required this.status, + required this.logs, + required this.renewAt, + }); + + factory ProxyRule.fromMap(Map map) { + return ProxyRule( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + domain: map['domain'].toString(), + type: map['type'].toString(), + trigger: map['trigger'].toString(), + redirectUrl: map['redirectUrl'].toString(), + redirectStatusCode: map['redirectStatusCode'], + deploymentId: map['deploymentId'].toString(), + deploymentResourceType: map['deploymentResourceType'] != null ? enums.ProxyRuleDeploymentResourceType.values.firstWhere((e) => e.value == map['deploymentResourceType']) : null, + deploymentResourceId: map['deploymentResourceId'].toString(), + deploymentVcsProviderBranch: map['deploymentVcsProviderBranch'].toString(), + status: enums.ProxyRuleStatus.values.firstWhere((e) => e.value == map['status']), + logs: map['logs'].toString(), + renewAt: map['renewAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "domain": domain, + "type": type, + "trigger": trigger, + "redirectUrl": redirectUrl, + "redirectStatusCode": redirectStatusCode, + "deploymentId": deploymentId, + "deploymentResourceType": deploymentResourceType?.value, + "deploymentResourceId": deploymentResourceId, + "deploymentVcsProviderBranch": deploymentVcsProviderBranch, + "status": status.value, + "logs": logs, + "renewAt": renewAt, + }; + } +} diff --git a/lib/src/models/proxy_rule_list.dart b/lib/src/models/proxy_rule_list.dart new file mode 100644 index 00000000..2e047986 --- /dev/null +++ b/lib/src/models/proxy_rule_list.dart @@ -0,0 +1,30 @@ +part of '../../models.dart'; + +/// Rule List +class ProxyRuleList implements Model { + /// Total number of rules that matched your query. + final int total; + + /// List of rules. + final List rules; + + ProxyRuleList({ + required this.total, + required this.rules, + }); + + factory ProxyRuleList.fromMap(Map map) { + return ProxyRuleList( + total: map['total'], + rules: List.from(map['rules'].map((p) => ProxyRule.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "total": total, + "rules": rules.map((p) => p.toMap()).toList(), + }; + } +} diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index 341dca63..75d0e707 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,59 +2,59 @@ part of '../../models.dart'; /// ResourceToken class ResourceToken implements Model { - /// Token ID. - final String $id; - - /// Token creation date in ISO 8601 format. - final String $createdAt; - - /// Resource ID. - final String resourceId; - - /// Resource type. - final String resourceType; - - /// Token expiration date in ISO 8601 format. - final String expire; - - /// JWT encoded string. - final String secret; - - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; - - ResourceToken({ - required this.$id, - required this.$createdAt, - required this.resourceId, - required this.resourceType, - required this.expire, - required this.secret, - required this.accessedAt, - }); - - factory ResourceToken.fromMap(Map map) { - return ResourceToken( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - resourceId: map['resourceId'].toString(), - resourceType: map['resourceType'].toString(), - expire: map['expire'].toString(), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "resourceId": resourceId, - "resourceType": resourceType, - "expire": expire, - "secret": secret, - "accessedAt": accessedAt, - }; - } + /// Token ID. + final String $id; + + /// Token creation date in ISO 8601 format. + final String $createdAt; + + /// Resource ID. + final String resourceId; + + /// Resource type. + final String resourceType; + + /// Token expiration date in ISO 8601 format. + final String expire; + + /// JWT encoded string. + final String secret; + + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; + + ResourceToken({ + required this.$id, + required this.$createdAt, + required this.resourceId, + required this.resourceType, + required this.expire, + required this.secret, + required this.accessedAt, + }); + + factory ResourceToken.fromMap(Map map) { + return ResourceToken( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + resourceId: map['resourceId'].toString(), + resourceType: map['resourceType'].toString(), + expire: map['expire'].toString(), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "resourceId": resourceId, + "resourceType": resourceType, + "expire": expire, + "secret": secret, + "accessedAt": accessedAt, + }; + } } diff --git a/lib/src/models/resource_token_list.dart b/lib/src/models/resource_token_list.dart index aa9918d2..52136854 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens that matched your query. - final int total; + /// Total number of tokens that matched your query. + final int total; - /// List of tokens. - final List tokens; + /// List of tokens. + final List tokens; - ResourceTokenList({ - required this.total, - required this.tokens, - }); + ResourceTokenList({ + required this.total, + required this.tokens, + }); - factory ResourceTokenList.fromMap(Map map) { - return ResourceTokenList( - total: map['total'], - tokens: List.from( - map['tokens'].map((p) => ResourceToken.fromMap(p))), - ); - } + factory ResourceTokenList.fromMap(Map map) { + return ResourceTokenList( + total: map['total'], + tokens: List.from(map['tokens'].map((p) => ResourceToken.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "tokens": tokens.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/row.dart b/lib/src/models/row.dart index a825eab0..c5f233b4 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,66 +2,66 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row sequence ID. - final String $sequence; + /// Row sequence ID. + final String $sequence; - /// Table ID. - final String $tableId; + /// Table ID. + final String $tableId; - /// Database ID. - final String $databaseId; + /// Database ID. + final String $databaseId; - /// Row creation date in ISO 8601 format. - final String $createdAt; + /// Row creation date in ISO 8601 format. + final String $createdAt; - /// Row update date in ISO 8601 format. - final String $updatedAt; + /// Row update date in ISO 8601 format. + final String $updatedAt; - /// Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - final Map data; + final Map data; - Row({ - required this.$id, - required this.$sequence, - required this.$tableId, - required this.$databaseId, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.data, - }); + Row({ + required this.$id, + required this.$sequence, + required this.$tableId, + required this.$databaseId, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.data, + }); - factory Row.fromMap(Map map) { - return Row( - $id: map['\$id'].toString(), - $sequence: map['\$sequence'].toString(), - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map["data"] ?? map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$tableId": $tableId, + "\$databaseId": $databaseId, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/row_list.dart b/lib/src/models/row_list.dart index 5023c633..90efa95f 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,32 +2,32 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows that matched your query. - final int total; + /// Total number of rows that matched your query. + final int total; - /// List of rows. - final List rows; + /// List of rows. + final List rows; - RowList({ - required this.total, - required this.rows, - }); + RowList({ + required this.total, + required this.rows, + }); - factory RowList.fromMap(Map map) { - return RowList( - total: map['total'], - rows: List.from(map['rows'].map((p) => Row.fromMap(p))), - ); - } + factory RowList.fromMap(Map map) { + return RowList( + total: map['total'], + rows: List.from(map['rows'].map((p) => Row.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "rows": rows.map((p) => p.toMap()).toList(), + }; + } - List convertTo(T Function(Map) fromJson) => - rows.map((d) => d.convertTo(fromJson)).toList(); + List convertTo(T Function(Map) fromJson) => + rows.map((d) => d.convertTo(fromJson)).toList(); } diff --git a/lib/src/models/runtime.dart b/lib/src/models/runtime.dart index b989950c..92f1a93b 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Runtime class Runtime implements Model { - /// Runtime ID. - final String $id; + /// Runtime ID. + final String $id; - /// Parent runtime key. - final String key; + /// Parent runtime key. + final String key; - /// Runtime Name. - final String name; + /// Runtime Name. + final String name; - /// Runtime version. - final String version; + /// Runtime version. + final String version; - /// Base Docker image used to build the runtime. - final String base; + /// Base Docker image used to build the runtime. + final String base; - /// Image name of Docker Hub. - final String image; + /// Image name of Docker Hub. + final String image; - /// Name of the logo image. - final String logo; + /// Name of the logo image. + final String logo; - /// List of supported architectures. - final List supports; + /// List of supported architectures. + final List supports; - Runtime({ - required this.$id, - required this.key, - required this.name, - required this.version, - required this.base, - required this.image, - required this.logo, - required this.supports, - }); + Runtime({ + required this.$id, + required this.key, + required this.name, + required this.version, + required this.base, + required this.image, + required this.logo, + required this.supports, + }); - factory Runtime.fromMap(Map map) { - return Runtime( - $id: map['\$id'].toString(), - key: map['key'].toString(), - name: map['name'].toString(), - version: map['version'].toString(), - base: map['base'].toString(), - image: map['image'].toString(), - logo: map['logo'].toString(), - supports: List.from(map['supports'] ?? []), - ); - } + factory Runtime.fromMap(Map map) { + return Runtime( + $id: map['\$id'].toString(), + key: map['key'].toString(), + name: map['name'].toString(), + version: map['version'].toString(), + base: map['base'].toString(), + image: map['image'].toString(), + logo: map['logo'].toString(), + supports: List.from(map['supports'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "key": key, + "name": name, + "version": version, + "base": base, + "image": image, + "logo": logo, + "supports": supports, + }; + } } diff --git a/lib/src/models/runtime_list.dart b/lib/src/models/runtime_list.dart index f4169a55..c9d0c3cb 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes that matched your query. - final int total; + /// Total number of runtimes that matched your query. + final int total; - /// List of runtimes. - final List runtimes; + /// List of runtimes. + final List runtimes; - RuntimeList({ - required this.total, - required this.runtimes, - }); + RuntimeList({ + required this.total, + required this.runtimes, + }); - factory RuntimeList.fromMap(Map map) { - return RuntimeList( - total: map['total'], - runtimes: - List.from(map['runtimes'].map((p) => Runtime.fromMap(p))), - ); - } + factory RuntimeList.fromMap(Map map) { + return RuntimeList( + total: map['total'], + runtimes: List.from(map['runtimes'].map((p) => Runtime.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "runtimes": runtimes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/session.dart b/lib/src/models/session.dart index 92e4034e..c37de95a 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,191 +2,191 @@ part of '../../models.dart'; /// Session class Session implements Model { - /// Session ID. - final String $id; + /// Session ID. + final String $id; - /// Session creation date in ISO 8601 format. - final String $createdAt; + /// Session creation date in ISO 8601 format. + final String $createdAt; - /// Session update date in ISO 8601 format. - final String $updatedAt; + /// Session update date in ISO 8601 format. + final String $updatedAt; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Session expiration date in ISO 8601 format. - final String expire; + /// Session expiration date in ISO 8601 format. + final String expire; - /// Session Provider. - final String provider; + /// Session Provider. + final String provider; - /// Session Provider User ID. - final String providerUid; + /// Session Provider User ID. + final String providerUid; - /// Session Provider Access Token. - final String providerAccessToken; - - /// The date of when the access token expires in ISO 8601 format. - final String providerAccessTokenExpiry; - - /// Session Provider Refresh Token. - final String providerRefreshToken; - - /// IP in use when the session was created. - final String ip; - - /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - final String osCode; - - /// Operating system name. - final String osName; - - /// Operating system version. - final String osVersion; - - /// Client type. - final String clientType; - - /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - final String clientCode; - - /// Client name. - final String clientName; - - /// Client version. - final String clientVersion; - - /// Client engine name. - final String clientEngine; - - /// Client engine name. - final String clientEngineVersion; - - /// Device name. - final String deviceName; - - /// Device brand name. - final String deviceBrand; - - /// Device model name. - final String deviceModel; - - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; - - /// Country name. - final String countryName; - - /// Returns true if this the current user session. - final bool current; - - /// Returns a list of active session factors. - final List factors; - - /// Secret used to authenticate the user. Only included if the request was made with an API key - final String secret; - - /// Most recent date in ISO 8601 format when the session successfully passed MFA challenge. - final String mfaUpdatedAt; - - Session({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.userId, - required this.expire, - required this.provider, - required this.providerUid, - required this.providerAccessToken, - required this.providerAccessTokenExpiry, - required this.providerRefreshToken, - required this.ip, - required this.osCode, - required this.osName, - required this.osVersion, - required this.clientType, - required this.clientCode, - required this.clientName, - required this.clientVersion, - required this.clientEngine, - required this.clientEngineVersion, - required this.deviceName, - required this.deviceBrand, - required this.deviceModel, - required this.countryCode, - required this.countryName, - required this.current, - required this.factors, - required this.secret, - required this.mfaUpdatedAt, - }); - - factory Session.fromMap(Map map) { - return Session( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - userId: map['userId'].toString(), - expire: map['expire'].toString(), - provider: map['provider'].toString(), - providerUid: map['providerUid'].toString(), - providerAccessToken: map['providerAccessToken'].toString(), - providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), - providerRefreshToken: map['providerRefreshToken'].toString(), - ip: map['ip'].toString(), - osCode: map['osCode'].toString(), - osName: map['osName'].toString(), - osVersion: map['osVersion'].toString(), - clientType: map['clientType'].toString(), - clientCode: map['clientCode'].toString(), - clientName: map['clientName'].toString(), - clientVersion: map['clientVersion'].toString(), - clientEngine: map['clientEngine'].toString(), - clientEngineVersion: map['clientEngineVersion'].toString(), - deviceName: map['deviceName'].toString(), - deviceBrand: map['deviceBrand'].toString(), - deviceModel: map['deviceModel'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - current: map['current'], - factors: List.from(map['factors'] ?? []), - secret: map['secret'].toString(), - mfaUpdatedAt: map['mfaUpdatedAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "expire": expire, - "provider": provider, - "providerUid": providerUid, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - "ip": ip, - "osCode": osCode, - "osName": osName, - "osVersion": osVersion, - "clientType": clientType, - "clientCode": clientCode, - "clientName": clientName, - "clientVersion": clientVersion, - "clientEngine": clientEngine, - "clientEngineVersion": clientEngineVersion, - "deviceName": deviceName, - "deviceBrand": deviceBrand, - "deviceModel": deviceModel, - "countryCode": countryCode, - "countryName": countryName, - "current": current, - "factors": factors, - "secret": secret, - "mfaUpdatedAt": mfaUpdatedAt, - }; - } + /// Session Provider Access Token. + final String providerAccessToken; + + /// The date of when the access token expires in ISO 8601 format. + final String providerAccessTokenExpiry; + + /// Session Provider Refresh Token. + final String providerRefreshToken; + + /// IP in use when the session was created. + final String ip; + + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + final String osCode; + + /// Operating system name. + final String osName; + + /// Operating system version. + final String osVersion; + + /// Client type. + final String clientType; + + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + final String clientCode; + + /// Client name. + final String clientName; + + /// Client version. + final String clientVersion; + + /// Client engine name. + final String clientEngine; + + /// Client engine name. + final String clientEngineVersion; + + /// Device name. + final String deviceName; + + /// Device brand name. + final String deviceBrand; + + /// Device model name. + final String deviceModel; + + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; + + /// Country name. + final String countryName; + + /// Returns true if this the current user session. + final bool current; + + /// Returns a list of active session factors. + final List factors; + + /// Secret used to authenticate the user. Only included if the request was made with an API key + final String secret; + + /// Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + final String mfaUpdatedAt; + + Session({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.userId, + required this.expire, + required this.provider, + required this.providerUid, + required this.providerAccessToken, + required this.providerAccessTokenExpiry, + required this.providerRefreshToken, + required this.ip, + required this.osCode, + required this.osName, + required this.osVersion, + required this.clientType, + required this.clientCode, + required this.clientName, + required this.clientVersion, + required this.clientEngine, + required this.clientEngineVersion, + required this.deviceName, + required this.deviceBrand, + required this.deviceModel, + required this.countryCode, + required this.countryName, + required this.current, + required this.factors, + required this.secret, + required this.mfaUpdatedAt, + }); + + factory Session.fromMap(Map map) { + return Session( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + userId: map['userId'].toString(), + expire: map['expire'].toString(), + provider: map['provider'].toString(), + providerUid: map['providerUid'].toString(), + providerAccessToken: map['providerAccessToken'].toString(), + providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), + providerRefreshToken: map['providerRefreshToken'].toString(), + ip: map['ip'].toString(), + osCode: map['osCode'].toString(), + osName: map['osName'].toString(), + osVersion: map['osVersion'].toString(), + clientType: map['clientType'].toString(), + clientCode: map['clientCode'].toString(), + clientName: map['clientName'].toString(), + clientVersion: map['clientVersion'].toString(), + clientEngine: map['clientEngine'].toString(), + clientEngineVersion: map['clientEngineVersion'].toString(), + deviceName: map['deviceName'].toString(), + deviceBrand: map['deviceBrand'].toString(), + deviceModel: map['deviceModel'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + current: map['current'], + factors: List.from(map['factors'] ?? []), + secret: map['secret'].toString(), + mfaUpdatedAt: map['mfaUpdatedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "userId": userId, + "expire": expire, + "provider": provider, + "providerUid": providerUid, + "providerAccessToken": providerAccessToken, + "providerAccessTokenExpiry": providerAccessTokenExpiry, + "providerRefreshToken": providerRefreshToken, + "ip": ip, + "osCode": osCode, + "osName": osName, + "osVersion": osVersion, + "clientType": clientType, + "clientCode": clientCode, + "clientName": clientName, + "clientVersion": clientVersion, + "clientEngine": clientEngine, + "clientEngineVersion": clientEngineVersion, + "deviceName": deviceName, + "deviceBrand": deviceBrand, + "deviceModel": deviceModel, + "countryCode": countryCode, + "countryName": countryName, + "current": current, + "factors": factors, + "secret": secret, + "mfaUpdatedAt": mfaUpdatedAt, + }; + } } diff --git a/lib/src/models/session_list.dart b/lib/src/models/session_list.dart index 4ea12394..d823d0e6 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions that matched your query. - final int total; + /// Total number of sessions that matched your query. + final int total; - /// List of sessions. - final List sessions; + /// List of sessions. + final List sessions; - SessionList({ - required this.total, - required this.sessions, - }); + SessionList({ + required this.total, + required this.sessions, + }); - factory SessionList.fromMap(Map map) { - return SessionList( - total: map['total'], - sessions: - List.from(map['sessions'].map((p) => Session.fromMap(p))), - ); - } + factory SessionList.fromMap(Map map) { + return SessionList( + total: map['total'], + sessions: List.from(map['sessions'].map((p) => Session.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "sessions": sessions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/site.dart b/lib/src/models/site.dart index d2594ea7..3bb19891 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,209 +2,209 @@ part of '../../models.dart'; /// Site class Site implements Model { - /// Site ID. - final String $id; + /// Site ID. + final String $id; - /// Site creation date in ISO 8601 format. - final String $createdAt; + /// Site creation date in ISO 8601 format. + final String $createdAt; - /// Site update date in ISO 8601 format. - final String $updatedAt; + /// Site update date in ISO 8601 format. + final String $updatedAt; - /// Site name. - final String name; + /// Site name. + final String name; - /// Site enabled. - final bool enabled; + /// Site enabled. + final bool enabled; - /// Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. - final bool live; + /// Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. + final bool live; - /// When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - final bool logging; + /// When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + final bool logging; - /// Site framework. - final String framework; + /// Site framework. + final String framework; - /// How many days to keep the non-active deployments before they will be automatically deleted. - final int deploymentRetention; + /// How many days to keep the non-active deployments before they will be automatically deleted. + final int deploymentRetention; - /// Site's active deployment ID. - final String deploymentId; + /// Site's active deployment ID. + final String deploymentId; - /// Active deployment creation date in ISO 8601 format. - final String deploymentCreatedAt; + /// Active deployment creation date in ISO 8601 format. + final String deploymentCreatedAt; - /// Screenshot of active deployment with light theme preference file ID. - final String deploymentScreenshotLight; - - /// Screenshot of active deployment with dark theme preference file ID. - final String deploymentScreenshotDark; - - /// Site's latest deployment ID. - final String latestDeploymentId; - - /// Latest deployment creation date in ISO 8601 format. - final String latestDeploymentCreatedAt; - - /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - final String latestDeploymentStatus; - - /// Site variables. - final List vars; - - /// Site request timeout in seconds. - final int timeout; - - /// The install command used to install the site dependencies. - final String installCommand; - - /// The build command used to build the site. - final String buildCommand; - - /// Custom command to use when starting site runtime. - final String startCommand; - - /// The directory where the site build output is located. - final String outputDirectory; - - /// Site VCS (Version Control System) installation id. - final String installationId; - - /// VCS (Version Control System) Repository ID - final String providerRepositoryId; - - /// VCS (Version Control System) branch name - final String providerBranch; - - /// Path to site in VCS (Version Control System) repository - final String providerRootDirectory; - - /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - final bool providerSilentMode; - - /// Machine specification for deployment builds. - final String buildSpecification; - - /// Machine specification for SSR executions. - final String runtimeSpecification; - - /// Site build runtime. - final String buildRuntime; - - /// Site framework adapter. - final String adapter; - - /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - final String fallbackFile; - - Site({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.enabled, - required this.live, - required this.logging, - required this.framework, - required this.deploymentRetention, - required this.deploymentId, - required this.deploymentCreatedAt, - required this.deploymentScreenshotLight, - required this.deploymentScreenshotDark, - required this.latestDeploymentId, - required this.latestDeploymentCreatedAt, - required this.latestDeploymentStatus, - required this.vars, - required this.timeout, - required this.installCommand, - required this.buildCommand, - required this.startCommand, - required this.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.buildSpecification, - required this.runtimeSpecification, - required this.buildRuntime, - required this.adapter, - required this.fallbackFile, - }); - - factory Site.fromMap(Map map) { - return Site( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - enabled: map['enabled'], - live: map['live'], - logging: map['logging'], - framework: map['framework'].toString(), - deploymentRetention: map['deploymentRetention'], - deploymentId: map['deploymentId'].toString(), - deploymentCreatedAt: map['deploymentCreatedAt'].toString(), - deploymentScreenshotLight: map['deploymentScreenshotLight'].toString(), - deploymentScreenshotDark: map['deploymentScreenshotDark'].toString(), - latestDeploymentId: map['latestDeploymentId'].toString(), - latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), - latestDeploymentStatus: map['latestDeploymentStatus'].toString(), - vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), - timeout: map['timeout'], - installCommand: map['installCommand'].toString(), - buildCommand: map['buildCommand'].toString(), - startCommand: map['startCommand'].toString(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - buildSpecification: map['buildSpecification'].toString(), - runtimeSpecification: map['runtimeSpecification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "deploymentRetention": deploymentRetention, - "deploymentId": deploymentId, - "deploymentCreatedAt": deploymentCreatedAt, - "deploymentScreenshotLight": deploymentScreenshotLight, - "deploymentScreenshotDark": deploymentScreenshotDark, - "latestDeploymentId": latestDeploymentId, - "latestDeploymentCreatedAt": latestDeploymentCreatedAt, - "latestDeploymentStatus": latestDeploymentStatus, - "vars": vars.map((p) => p.toMap()).toList(), - "timeout": timeout, - "installCommand": installCommand, - "buildCommand": buildCommand, - "startCommand": startCommand, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "buildSpecification": buildSpecification, - "runtimeSpecification": runtimeSpecification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Screenshot of active deployment with light theme preference file ID. + final String deploymentScreenshotLight; + + /// Screenshot of active deployment with dark theme preference file ID. + final String deploymentScreenshotDark; + + /// Site's latest deployment ID. + final String latestDeploymentId; + + /// Latest deployment creation date in ISO 8601 format. + final String latestDeploymentCreatedAt; + + /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + final String latestDeploymentStatus; + + /// Site variables. + final List vars; + + /// Site request timeout in seconds. + final int timeout; + + /// The install command used to install the site dependencies. + final String installCommand; + + /// The build command used to build the site. + final String buildCommand; + + /// Custom command to use when starting site runtime. + final String startCommand; + + /// The directory where the site build output is located. + final String outputDirectory; + + /// Site VCS (Version Control System) installation id. + final String installationId; + + /// VCS (Version Control System) Repository ID + final String providerRepositoryId; + + /// VCS (Version Control System) branch name + final String providerBranch; + + /// Path to site in VCS (Version Control System) repository + final String providerRootDirectory; + + /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + final bool providerSilentMode; + + /// Machine specification for deployment builds. + final String buildSpecification; + + /// Machine specification for SSR executions. + final String runtimeSpecification; + + /// Site build runtime. + final String buildRuntime; + + /// Site framework adapter. + final String adapter; + + /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + final String fallbackFile; + + Site({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.enabled, + required this.live, + required this.logging, + required this.framework, + required this.deploymentRetention, + required this.deploymentId, + required this.deploymentCreatedAt, + required this.deploymentScreenshotLight, + required this.deploymentScreenshotDark, + required this.latestDeploymentId, + required this.latestDeploymentCreatedAt, + required this.latestDeploymentStatus, + required this.vars, + required this.timeout, + required this.installCommand, + required this.buildCommand, + required this.startCommand, + required this.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.buildSpecification, + required this.runtimeSpecification, + required this.buildRuntime, + required this.adapter, + required this.fallbackFile, + }); + + factory Site.fromMap(Map map) { + return Site( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + enabled: map['enabled'], + live: map['live'], + logging: map['logging'], + framework: map['framework'].toString(), + deploymentRetention: map['deploymentRetention'], + deploymentId: map['deploymentId'].toString(), + deploymentCreatedAt: map['deploymentCreatedAt'].toString(), + deploymentScreenshotLight: map['deploymentScreenshotLight'].toString(), + deploymentScreenshotDark: map['deploymentScreenshotDark'].toString(), + latestDeploymentId: map['latestDeploymentId'].toString(), + latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), + latestDeploymentStatus: map['latestDeploymentStatus'].toString(), + vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), + timeout: map['timeout'], + installCommand: map['installCommand'].toString(), + buildCommand: map['buildCommand'].toString(), + startCommand: map['startCommand'].toString(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + buildSpecification: map['buildSpecification'].toString(), + runtimeSpecification: map['runtimeSpecification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "deploymentRetention": deploymentRetention, + "deploymentId": deploymentId, + "deploymentCreatedAt": deploymentCreatedAt, + "deploymentScreenshotLight": deploymentScreenshotLight, + "deploymentScreenshotDark": deploymentScreenshotDark, + "latestDeploymentId": latestDeploymentId, + "latestDeploymentCreatedAt": latestDeploymentCreatedAt, + "latestDeploymentStatus": latestDeploymentStatus, + "vars": vars.map((p) => p.toMap()).toList(), + "timeout": timeout, + "installCommand": installCommand, + "buildCommand": buildCommand, + "startCommand": startCommand, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "buildSpecification": buildSpecification, + "runtimeSpecification": runtimeSpecification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index 27bff61f..ab1a72c5 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites that matched your query. - final int total; + /// Total number of sites that matched your query. + final int total; - /// List of sites. - final List sites; + /// List of sites. + final List sites; - SiteList({ - required this.total, - required this.sites, - }); + SiteList({ + required this.total, + required this.sites, + }); - factory SiteList.fromMap(Map map) { - return SiteList( - total: map['total'], - sites: List.from(map['sites'].map((p) => Site.fromMap(p))), - ); - } + factory SiteList.fromMap(Map map) { + return SiteList( + total: map['total'], + sites: List.from(map['sites'].map((p) => Site.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "sites": sites.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/specification.dart b/lib/src/models/specification.dart index b1820b26..6ef82642 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// Specification class Specification implements Model { - /// Memory size in MB. - final int memory; + /// Memory size in MB. + final int memory; - /// Number of CPUs. - final double cpus; + /// Number of CPUs. + final double cpus; - /// Is size enabled. - final bool enabled; + /// Is size enabled. + final bool enabled; - /// Size slug. - final String slug; + /// Size slug. + final String slug; - Specification({ - required this.memory, - required this.cpus, - required this.enabled, - required this.slug, - }); + Specification({ + required this.memory, + required this.cpus, + required this.enabled, + required this.slug, + }); - factory Specification.fromMap(Map map) { - return Specification( - memory: map['memory'], - cpus: map['cpus'].toDouble(), - enabled: map['enabled'], - slug: map['slug'].toString(), - ); - } + factory Specification.fromMap(Map map) { + return Specification( + memory: map['memory'], + cpus: map['cpus'].toDouble(), + enabled: map['enabled'], + slug: map['slug'].toString(), + ); + } - @override - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + @override + Map toMap() { + return { + "memory": memory, + "cpus": cpus, + "enabled": enabled, + "slug": slug, + }; + } } diff --git a/lib/src/models/specification_list.dart b/lib/src/models/specification_list.dart index 245e08c6..ac645338 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications that matched your query. - final int total; + /// Total number of specifications that matched your query. + final int total; - /// List of specifications. - final List specifications; + /// List of specifications. + final List specifications; - SpecificationList({ - required this.total, - required this.specifications, - }); + SpecificationList({ + required this.total, + required this.specifications, + }); - factory SpecificationList.fromMap(Map map) { - return SpecificationList( - total: map['total'], - specifications: List.from( - map['specifications'].map((p) => Specification.fromMap(p))), - ); - } + factory SpecificationList.fromMap(Map map) { + return SpecificationList( + total: map['total'], + specifications: List.from(map['specifications'].map((p) => Specification.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "specifications": specifications.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/subscriber.dart b/lib/src/models/subscriber.dart index 450aafd1..850ab8d2 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Subscriber class Subscriber implements Model { - /// Subscriber ID. - final String $id; + /// Subscriber ID. + final String $id; - /// Subscriber creation time in ISO 8601 format. - final String $createdAt; + /// Subscriber creation time in ISO 8601 format. + final String $createdAt; - /// Subscriber update date in ISO 8601 format. - final String $updatedAt; + /// Subscriber update date in ISO 8601 format. + final String $updatedAt; - /// Target ID. - final String targetId; + /// Target ID. + final String targetId; - /// Target. - final Target target; + /// Target. + final Target target; - /// Topic ID. - final String userId; + /// Topic ID. + final String userId; - /// User Name. - final String userName; + /// User Name. + final String userName; - /// Topic ID. - final String topicId; + /// Topic ID. + final String topicId; - /// The target provider type. Can be one of the following: `email`, `sms` or `push`. - final String providerType; + /// The target provider type. Can be one of the following: `email`, `sms` or `push`. + final String providerType; - Subscriber({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.targetId, - required this.target, - required this.userId, - required this.userName, - required this.topicId, - required this.providerType, - }); + Subscriber({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.targetId, + required this.target, + required this.userId, + required this.userName, + required this.topicId, + required this.providerType, + }); - factory Subscriber.fromMap(Map map) { - return Subscriber( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - targetId: map['targetId'].toString(), - target: Target.fromMap(map['target']), - userId: map['userId'].toString(), - userName: map['userName'].toString(), - topicId: map['topicId'].toString(), - providerType: map['providerType'].toString(), - ); - } + factory Subscriber.fromMap(Map map) { + return Subscriber( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + targetId: map['targetId'].toString(), + target: Target.fromMap(map['target']), + userId: map['userId'].toString(), + userName: map['userName'].toString(), + topicId: map['topicId'].toString(), + providerType: map['providerType'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "targetId": targetId, + "target": target.toMap(), + "userId": userId, + "userName": userName, + "topicId": topicId, + "providerType": providerType, + }; + } } diff --git a/lib/src/models/subscriber_list.dart b/lib/src/models/subscriber_list.dart index 14fbf27e..3eb2e4fc 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers that matched your query. - final int total; + /// Total number of subscribers that matched your query. + final int total; - /// List of subscribers. - final List subscribers; + /// List of subscribers. + final List subscribers; - SubscriberList({ - required this.total, - required this.subscribers, - }); + SubscriberList({ + required this.total, + required this.subscribers, + }); - factory SubscriberList.fromMap(Map map) { - return SubscriberList( - total: map['total'], - subscribers: List.from( - map['subscribers'].map((p) => Subscriber.fromMap(p))), - ); - } + factory SubscriberList.fromMap(Map map) { + return SubscriberList( + total: map['total'], + subscribers: List.from(map['subscribers'].map((p) => Subscriber.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "subscribers": subscribers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/table.dart b/lib/src/models/table.dart index 9d0cc834..ddb15ade 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,90 +2,89 @@ part of '../../models.dart'; /// Table class Table implements Model { - /// Table ID. - final String $id; + /// Table ID. + final String $id; - /// Table creation date in ISO 8601 format. - final String $createdAt; + /// Table creation date in ISO 8601 format. + final String $createdAt; - /// Table update date in ISO 8601 format. - final String $updatedAt; + /// Table update date in ISO 8601 format. + final String $updatedAt; - /// Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// Database ID. - final String databaseId; + /// Database ID. + final String databaseId; - /// Table name. - final String name; + /// Table name. + final String name; - /// Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. - final bool enabled; + /// Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. + final bool enabled; - /// Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - final bool rowSecurity; + /// Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool rowSecurity; - /// Table columns. - final List columns; + /// Table columns. + final List columns; - /// Table indexes. - final List indexes; + /// Table indexes. + final List indexes; - /// Maximum row size in bytes. Returns 0 when no limit applies. - final int bytesMax; + /// Maximum row size in bytes. Returns 0 when no limit applies. + final int bytesMax; - /// Currently used row size in bytes based on defined columns. - final int bytesUsed; + /// Currently used row size in bytes based on defined columns. + final int bytesUsed; - Table({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.databaseId, - required this.name, - required this.enabled, - required this.rowSecurity, - required this.columns, - required this.indexes, - required this.bytesMax, - required this.bytesUsed, - }); + Table({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.databaseId, + required this.name, + required this.enabled, + required this.rowSecurity, + required this.columns, + required this.indexes, + required this.bytesMax, + required this.bytesUsed, + }); - factory Table.fromMap(Map map) { - return Table( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - databaseId: map['databaseId'].toString(), - name: map['name'].toString(), - enabled: map['enabled'], - rowSecurity: map['rowSecurity'], - columns: List.from(map['columns'] ?? []), - indexes: List.from( - map['indexes'].map((p) => ColumnIndex.fromMap(p))), - bytesMax: map['bytesMax'], - bytesUsed: map['bytesUsed'], - ); - } + factory Table.fromMap(Map map) { + return Table( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + databaseId: map['databaseId'].toString(), + name: map['name'].toString(), + enabled: map['enabled'], + rowSecurity: map['rowSecurity'], + columns: List.from(map['columns'] ?? []), + indexes: List.from(map['indexes'].map((p) => ColumnIndex.fromMap(p))), + bytesMax: map['bytesMax'], + bytesUsed: map['bytesUsed'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "databaseId": databaseId, - "name": name, - "enabled": enabled, - "rowSecurity": rowSecurity, - "columns": columns, - "indexes": indexes.map((p) => p.toMap()).toList(), - "bytesMax": bytesMax, - "bytesUsed": bytesUsed, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "databaseId": databaseId, + "name": name, + "enabled": enabled, + "rowSecurity": rowSecurity, + "columns": columns, + "indexes": indexes.map((p) => p.toMap()).toList(), + "bytesMax": bytesMax, + "bytesUsed": bytesUsed, + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 1d05be5b..7836a60c 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables that matched your query. - final int total; + /// Total number of tables that matched your query. + final int total; - /// List of tables. - final List tables; + /// List of tables. + final List
tables; - TableList({ - required this.total, - required this.tables, - }); + TableList({ + required this.total, + required this.tables, + }); - factory TableList.fromMap(Map map) { - return TableList( - total: map['total'], - tables: List
.from(map['tables'].map((p) => Table.fromMap(p))), - ); - } + factory TableList.fromMap(Map map) { + return TableList( + total: map['total'], + tables: List
.from(map['tables'].map((p) => Table.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "tables": tables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/target.dart b/lib/src/models/target.dart index c2e8c4dc..742e7590 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Target class Target implements Model { - /// Target ID. - final String $id; + /// Target ID. + final String $id; - /// Target creation time in ISO 8601 format. - final String $createdAt; + /// Target creation time in ISO 8601 format. + final String $createdAt; - /// Target update date in ISO 8601 format. - final String $updatedAt; + /// Target update date in ISO 8601 format. + final String $updatedAt; - /// Target Name. - final String name; + /// Target Name. + final String name; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Provider ID. - final String? providerId; + /// Provider ID. + final String? providerId; - /// The target provider type. Can be one of the following: `email`, `sms` or `push`. - final String providerType; + /// The target provider type. Can be one of the following: `email`, `sms` or `push`. + final String providerType; - /// The target identifier. - final String identifier; + /// The target identifier. + final String identifier; - /// Is the target expired. - final bool expired; + /// Is the target expired. + final bool expired; - Target({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.userId, - this.providerId, - required this.providerType, - required this.identifier, - required this.expired, - }); + Target({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.userId, + this.providerId, + required this.providerType, + required this.identifier, + required this.expired, + }); - factory Target.fromMap(Map map) { - return Target( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - userId: map['userId'].toString(), - providerId: map['providerId']?.toString(), - providerType: map['providerType'].toString(), - identifier: map['identifier'].toString(), - expired: map['expired'], - ); - } + factory Target.fromMap(Map map) { + return Target( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + userId: map['userId'].toString(), + providerId: map['providerId']?.toString(), + providerType: map['providerType'].toString(), + identifier: map['identifier'].toString(), + expired: map['expired'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "userId": userId, + "providerId": providerId, + "providerType": providerType, + "identifier": identifier, + "expired": expired, + }; + } } diff --git a/lib/src/models/target_list.dart b/lib/src/models/target_list.dart index b4e86bfb..614d1c4e 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets that matched your query. - final int total; + /// Total number of targets that matched your query. + final int total; - /// List of targets. - final List targets; + /// List of targets. + final List targets; - TargetList({ - required this.total, - required this.targets, - }); + TargetList({ + required this.total, + required this.targets, + }); - factory TargetList.fromMap(Map map) { - return TargetList( - total: map['total'], - targets: List.from(map['targets'].map((p) => Target.fromMap(p))), - ); - } + factory TargetList.fromMap(Map map) { + return TargetList( + total: map['total'], + targets: List.from(map['targets'].map((p) => Target.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "targets": targets.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/team.dart b/lib/src/models/team.dart index 91b888b9..21e65e95 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Team class Team implements Model { - /// Team ID. - final String $id; - - /// Team creation date in ISO 8601 format. - final String $createdAt; - - /// Team update date in ISO 8601 format. - final String $updatedAt; - - /// Team name. - final String name; - - /// Total number of team members. - final int total; - - /// Team preferences as a key-value object - final Preferences prefs; - - Team({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.total, - required this.prefs, - }); - - factory Team.fromMap(Map map) { - return Team( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - total: map['total'], - prefs: Preferences.fromMap(map['prefs']), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "total": total, - "prefs": prefs.toMap(), - }; - } + /// Team ID. + final String $id; + + /// Team creation date in ISO 8601 format. + final String $createdAt; + + /// Team update date in ISO 8601 format. + final String $updatedAt; + + /// Team name. + final String name; + + /// Total number of team members. + final int total; + + /// Team preferences as a key-value object + final Preferences prefs; + + Team({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.total, + required this.prefs, + }); + + factory Team.fromMap(Map map) { + return Team( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + total: map['total'], + prefs: Preferences.fromMap(map['prefs']), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "total": total, + "prefs": prefs.toMap(), + }; + } } diff --git a/lib/src/models/team_list.dart b/lib/src/models/team_list.dart index e8f1c621..ffca5e98 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams that matched your query. - final int total; + /// Total number of teams that matched your query. + final int total; - /// List of teams. - final List teams; + /// List of teams. + final List teams; - TeamList({ - required this.total, - required this.teams, - }); + TeamList({ + required this.total, + required this.teams, + }); - factory TeamList.fromMap(Map map) { - return TeamList( - total: map['total'], - teams: List.from(map['teams'].map((p) => Team.fromMap(p))), - ); - } + factory TeamList.fromMap(Map map) { + return TeamList( + total: map['total'], + teams: List.from(map['teams'].map((p) => Team.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "teams": teams.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/token.dart b/lib/src/models/token.dart index b5ea87c8..b05320da 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Token class Token implements Model { - /// Token ID. - final String $id; - - /// Token creation date in ISO 8601 format. - final String $createdAt; - - /// User ID. - final String userId; - - /// Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - final String secret; - - /// Token expiration date in ISO 8601 format. - final String expire; - - /// Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. - final String phrase; - - Token({ - required this.$id, - required this.$createdAt, - required this.userId, - required this.secret, - required this.expire, - required this.phrase, - }); - - factory Token.fromMap(Map map) { - return Token( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - userId: map['userId'].toString(), - secret: map['secret'].toString(), - expire: map['expire'].toString(), - phrase: map['phrase'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "secret": secret, - "expire": expire, - "phrase": phrase, - }; - } + /// Token ID. + final String $id; + + /// Token creation date in ISO 8601 format. + final String $createdAt; + + /// User ID. + final String userId; + + /// Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + final String secret; + + /// Token expiration date in ISO 8601 format. + final String expire; + + /// Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. + final String phrase; + + Token({ + required this.$id, + required this.$createdAt, + required this.userId, + required this.secret, + required this.expire, + required this.phrase, + }); + + factory Token.fromMap(Map map) { + return Token( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + userId: map['userId'].toString(), + secret: map['secret'].toString(), + expire: map['expire'].toString(), + phrase: map['phrase'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "userId": userId, + "secret": secret, + "expire": expire, + "phrase": phrase, + }; + } } diff --git a/lib/src/models/topic.dart b/lib/src/models/topic.dart index d817c799..b4646d13 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Topic class Topic implements Model { - /// Topic ID. - final String $id; + /// Topic ID. + final String $id; - /// Topic creation time in ISO 8601 format. - final String $createdAt; + /// Topic creation time in ISO 8601 format. + final String $createdAt; - /// Topic update date in ISO 8601 format. - final String $updatedAt; + /// Topic update date in ISO 8601 format. + final String $updatedAt; - /// The name of the topic. - final String name; + /// The name of the topic. + final String name; - /// Total count of email subscribers subscribed to the topic. - final int emailTotal; + /// Total count of email subscribers subscribed to the topic. + final int emailTotal; - /// Total count of SMS subscribers subscribed to the topic. - final int smsTotal; + /// Total count of SMS subscribers subscribed to the topic. + final int smsTotal; - /// Total count of push subscribers subscribed to the topic. - final int pushTotal; + /// Total count of push subscribers subscribed to the topic. + final int pushTotal; - /// Subscribe permissions. - final List subscribe; + /// Subscribe permissions. + final List subscribe; - Topic({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.emailTotal, - required this.smsTotal, - required this.pushTotal, - required this.subscribe, - }); + Topic({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.emailTotal, + required this.smsTotal, + required this.pushTotal, + required this.subscribe, + }); - factory Topic.fromMap(Map map) { - return Topic( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - emailTotal: map['emailTotal'], - smsTotal: map['smsTotal'], - pushTotal: map['pushTotal'], - subscribe: List.from(map['subscribe'] ?? []), - ); - } + factory Topic.fromMap(Map map) { + return Topic( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + emailTotal: map['emailTotal'], + smsTotal: map['smsTotal'], + pushTotal: map['pushTotal'], + subscribe: List.from(map['subscribe'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "emailTotal": emailTotal, + "smsTotal": smsTotal, + "pushTotal": pushTotal, + "subscribe": subscribe, + }; + } } diff --git a/lib/src/models/topic_list.dart b/lib/src/models/topic_list.dart index 3fb85f7f..9b0ce880 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics that matched your query. - final int total; + /// Total number of topics that matched your query. + final int total; - /// List of topics. - final List topics; + /// List of topics. + final List topics; - TopicList({ - required this.total, - required this.topics, - }); + TopicList({ + required this.total, + required this.topics, + }); - factory TopicList.fromMap(Map map) { - return TopicList( - total: map['total'], - topics: List.from(map['topics'].map((p) => Topic.fromMap(p))), - ); - } + factory TopicList.fromMap(Map map) { + return TopicList( + total: map['total'], + topics: List.from(map['topics'].map((p) => Topic.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/transaction.dart b/lib/src/models/transaction.dart index b0606dd8..e3f3e43d 100644 --- a/lib/src/models/transaction.dart +++ b/lib/src/models/transaction.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Transaction class Transaction implements Model { - /// Transaction ID. - final String $id; - - /// Transaction creation time in ISO 8601 format. - final String $createdAt; - - /// Transaction update date in ISO 8601 format. - final String $updatedAt; - - /// Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. - final String status; - - /// Number of operations in the transaction. - final int operations; - - /// Expiration time in ISO 8601 format. - final String expiresAt; - - Transaction({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.status, - required this.operations, - required this.expiresAt, - }); - - factory Transaction.fromMap(Map map) { - return Transaction( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - status: map['status'].toString(), - operations: map['operations'], - expiresAt: map['expiresAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "status": status, - "operations": operations, - "expiresAt": expiresAt, - }; - } + /// Transaction ID. + final String $id; + + /// Transaction creation time in ISO 8601 format. + final String $createdAt; + + /// Transaction update date in ISO 8601 format. + final String $updatedAt; + + /// Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + final String status; + + /// Number of operations in the transaction. + final int operations; + + /// Expiration time in ISO 8601 format. + final String expiresAt; + + Transaction({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.status, + required this.operations, + required this.expiresAt, + }); + + factory Transaction.fromMap(Map map) { + return Transaction( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + status: map['status'].toString(), + operations: map['operations'], + expiresAt: map['expiresAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "status": status, + "operations": operations, + "expiresAt": expiresAt, + }; + } } diff --git a/lib/src/models/transaction_list.dart b/lib/src/models/transaction_list.dart index 7f321175..19ea651d 100644 --- a/lib/src/models/transaction_list.dart +++ b/lib/src/models/transaction_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Transaction List class TransactionList implements Model { - /// Total number of transactions that matched your query. - final int total; + /// Total number of transactions that matched your query. + final int total; - /// List of transactions. - final List transactions; + /// List of transactions. + final List transactions; - TransactionList({ - required this.total, - required this.transactions, - }); + TransactionList({ + required this.total, + required this.transactions, + }); - factory TransactionList.fromMap(Map map) { - return TransactionList( - total: map['total'], - transactions: List.from( - map['transactions'].map((p) => Transaction.fromMap(p))), - ); - } + factory TransactionList.fromMap(Map map) { + return TransactionList( + total: map['total'], + transactions: List.from(map['transactions'].map((p) => Transaction.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "transactions": transactions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "transactions": transactions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index 67b7f448..a1da6caf 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,143 +2,143 @@ part of '../../models.dart'; /// User class User implements Model { - /// User ID. - final String $id; - - /// User creation date in ISO 8601 format. - final String $createdAt; - - /// User update date in ISO 8601 format. - final String $updatedAt; - - /// User name. - final String name; - - /// Hashed user password. - final String? password; - - /// Password hashing algorithm. - final String? hash; - - /// Password hashing algorithm configuration. - final Map? hashOptions; - - /// User registration date in ISO 8601 format. - final String registration; - - /// User status. Pass `true` for enabled and `false` for disabled. - final bool status; - - /// Labels for the user. - final List labels; - - /// Password update time in ISO 8601 format. - final String passwordUpdate; - - /// User email address. - final String email; - - /// User phone number in E.164 format. - final String phone; - - /// Email verification status. - final bool emailVerification; - - /// Phone verification status. - final bool phoneVerification; - - /// Multi factor authentication status. - final bool mfa; - - /// User preferences as a key-value object - final Preferences prefs; - - /// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. - final List targets; - - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; - - /// Whether the user can impersonate other users. - final bool? impersonator; - - /// ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. - final String? impersonatorUserId; - - User({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - this.password, - this.hash, - this.hashOptions, - required this.registration, - required this.status, - required this.labels, - required this.passwordUpdate, - required this.email, - required this.phone, - required this.emailVerification, - required this.phoneVerification, - required this.mfa, - required this.prefs, - required this.targets, - required this.accessedAt, - this.impersonator, - this.impersonatorUserId, - }); - - factory User.fromMap(Map map) { - return User( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - password: map['password']?.toString(), - hash: map['hash']?.toString(), - hashOptions: map['hashOptions'], - registration: map['registration'].toString(), - status: map['status'], - labels: List.from(map['labels'] ?? []), - passwordUpdate: map['passwordUpdate'].toString(), - email: map['email'].toString(), - phone: map['phone'].toString(), - emailVerification: map['emailVerification'], - phoneVerification: map['phoneVerification'], - mfa: map['mfa'], - prefs: Preferences.fromMap(map['prefs']), - targets: List.from(map['targets'].map((p) => Target.fromMap(p))), - accessedAt: map['accessedAt'].toString(), - impersonator: map['impersonator'], - impersonatorUserId: map['impersonatorUserId']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "password": password, - "hash": hash, - "hashOptions": hashOptions, - "registration": registration, - "status": status, - "labels": labels, - "passwordUpdate": passwordUpdate, - "email": email, - "phone": phone, - "emailVerification": emailVerification, - "phoneVerification": phoneVerification, - "mfa": mfa, - "prefs": prefs.toMap(), - "targets": targets.map((p) => p.toMap()).toList(), - "accessedAt": accessedAt, - "impersonator": impersonator, - "impersonatorUserId": impersonatorUserId, - }; - } + /// User ID. + final String $id; + + /// User creation date in ISO 8601 format. + final String $createdAt; + + /// User update date in ISO 8601 format. + final String $updatedAt; + + /// User name. + final String name; + + /// Hashed user password. + final String? password; + + /// Password hashing algorithm. + final String? hash; + + /// Password hashing algorithm configuration. + final Map? hashOptions; + + /// User registration date in ISO 8601 format. + final String registration; + + /// User status. Pass `true` for enabled and `false` for disabled. + final bool status; + + /// Labels for the user. + final List labels; + + /// Password update time in ISO 8601 format. + final String passwordUpdate; + + /// User email address. + final String email; + + /// User phone number in E.164 format. + final String phone; + + /// Email verification status. + final bool emailVerification; + + /// Phone verification status. + final bool phoneVerification; + + /// Multi factor authentication status. + final bool mfa; + + /// User preferences as a key-value object + final Preferences prefs; + + /// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + final List targets; + + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; + + /// Whether the user can impersonate other users. + final bool? impersonator; + + /// ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + final String? impersonatorUserId; + + User({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + this.password, + this.hash, + this.hashOptions, + required this.registration, + required this.status, + required this.labels, + required this.passwordUpdate, + required this.email, + required this.phone, + required this.emailVerification, + required this.phoneVerification, + required this.mfa, + required this.prefs, + required this.targets, + required this.accessedAt, + this.impersonator, + this.impersonatorUserId, + }); + + factory User.fromMap(Map map) { + return User( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + password: map['password']?.toString(), + hash: map['hash']?.toString(), + hashOptions: map['hashOptions'], + registration: map['registration'].toString(), + status: map['status'], + labels: List.from(map['labels'] ?? []), + passwordUpdate: map['passwordUpdate'].toString(), + email: map['email'].toString(), + phone: map['phone'].toString(), + emailVerification: map['emailVerification'], + phoneVerification: map['phoneVerification'], + mfa: map['mfa'], + prefs: Preferences.fromMap(map['prefs']), + targets: List.from(map['targets'].map((p) => Target.fromMap(p))), + accessedAt: map['accessedAt'].toString(), + impersonator: map['impersonator'], + impersonatorUserId: map['impersonatorUserId']?.toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "password": password, + "hash": hash, + "hashOptions": hashOptions, + "registration": registration, + "status": status, + "labels": labels, + "passwordUpdate": passwordUpdate, + "email": email, + "phone": phone, + "emailVerification": emailVerification, + "phoneVerification": phoneVerification, + "mfa": mfa, + "prefs": prefs.toMap(), + "targets": targets.map((p) => p.toMap()).toList(), + "accessedAt": accessedAt, + "impersonator": impersonator, + "impersonatorUserId": impersonatorUserId, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index b8cad001..1cad04c9 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users that matched your query. - final int total; + /// Total number of users that matched your query. + final int total; - /// List of users. - final List users; + /// List of users. + final List users; - UserList({ - required this.total, - required this.users, - }); + UserList({ + required this.total, + required this.users, + }); - factory UserList.fromMap(Map map) { - return UserList( - total: map['total'], - users: List.from(map['users'].map((p) => User.fromMap(p))), - ); - } + factory UserList.fromMap(Map map) { + return UserList( + total: map['total'], + users: List.from(map['users'].map((p) => User.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "users": users.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/variable.dart b/lib/src/models/variable.dart index ce813323..284e422c 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Variable class Variable implements Model { - /// Variable ID. - final String $id; + /// Variable ID. + final String $id; - /// Variable creation date in ISO 8601 format. - final String $createdAt; + /// Variable creation date in ISO 8601 format. + final String $createdAt; - /// Variable creation date in ISO 8601 format. - final String $updatedAt; + /// Variable creation date in ISO 8601 format. + final String $updatedAt; - /// Variable key. - final String key; + /// Variable key. + final String key; - /// Variable value. - final String value; + /// Variable value. + final String value; - /// Variable secret flag. Secret variables can only be updated or deleted, but never read. - final bool secret; + /// Variable secret flag. Secret variables can only be updated or deleted, but never read. + final bool secret; - /// Service to which the variable belongs. Possible values are "project", "function" - final String resourceType; + /// Service to which the variable belongs. Possible values are "project", "function" + final String resourceType; - /// ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. - final String resourceId; + /// ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + final String resourceId; - Variable({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.key, - required this.value, - required this.secret, - required this.resourceType, - required this.resourceId, - }); + Variable({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.key, + required this.value, + required this.secret, + required this.resourceType, + required this.resourceId, + }); - factory Variable.fromMap(Map map) { - return Variable( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - key: map['key'].toString(), - value: map['value'].toString(), - secret: map['secret'], - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - ); - } + factory Variable.fromMap(Map map) { + return Variable( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + key: map['key'].toString(), + value: map['value'].toString(), + secret: map['secret'], + resourceType: map['resourceType'].toString(), + resourceId: map['resourceId'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "value": value, + "secret": secret, + "resourceType": resourceType, + "resourceId": resourceId, + }; + } } diff --git a/lib/src/models/variable_list.dart b/lib/src/models/variable_list.dart index 6a0e5bad..4e8b7d9f 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables that matched your query. - final int total; + /// Total number of variables that matched your query. + final int total; - /// List of variables. - final List variables; + /// List of variables. + final List variables; - VariableList({ - required this.total, - required this.variables, - }); + VariableList({ + required this.total, + required this.variables, + }); - factory VariableList.fromMap(Map map) { - return VariableList( - total: map['total'], - variables: - List.from(map['variables'].map((p) => Variable.fromMap(p))), - ); - } + factory VariableList.fromMap(Map map) { + return VariableList( + total: map['total'], + variables: List.from(map['variables'].map((p) => Variable.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/webhook.dart b/lib/src/models/webhook.dart index 39f28f43..4f732d7b 100644 --- a/lib/src/models/webhook.dart +++ b/lib/src/models/webhook.dart @@ -2,95 +2,95 @@ part of '../../models.dart'; /// Webhook class Webhook implements Model { - /// Webhook ID. - final String $id; - - /// Webhook creation date in ISO 8601 format. - final String $createdAt; - - /// Webhook update date in ISO 8601 format. - final String $updatedAt; - - /// Webhook name. - final String name; - - /// Webhook URL endpoint. - final String url; - - /// Webhook trigger events. - final List events; - - /// Indicates if SSL / TLS certificate verification is enabled. - final bool tls; - - /// HTTP basic authentication username. - final String authUsername; - - /// HTTP basic authentication password. - final String authPassword; - - /// Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. - final String secret; - - /// Indicates if this webhook is enabled. - final bool enabled; - - /// Webhook error logs from the most recent failure. - final String logs; - - /// Number of consecutive failed webhook attempts. - final int attempts; - - Webhook({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.url, - required this.events, - required this.tls, - required this.authUsername, - required this.authPassword, - required this.secret, - required this.enabled, - required this.logs, - required this.attempts, - }); - - factory Webhook.fromMap(Map map) { - return Webhook( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - url: map['url'].toString(), - events: List.from(map['events'] ?? []), - tls: map['tls'], - authUsername: map['authUsername'].toString(), - authPassword: map['authPassword'].toString(), - secret: map['secret'].toString(), - enabled: map['enabled'], - logs: map['logs'].toString(), - attempts: map['attempts'], - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "url": url, - "events": events, - "tls": tls, - "authUsername": authUsername, - "authPassword": authPassword, - "secret": secret, - "enabled": enabled, - "logs": logs, - "attempts": attempts, - }; - } + /// Webhook ID. + final String $id; + + /// Webhook creation date in ISO 8601 format. + final String $createdAt; + + /// Webhook update date in ISO 8601 format. + final String $updatedAt; + + /// Webhook name. + final String name; + + /// Webhook URL endpoint. + final String url; + + /// Webhook trigger events. + final List events; + + /// Indicates if SSL / TLS certificate verification is enabled. + final bool tls; + + /// HTTP basic authentication username. + final String authUsername; + + /// HTTP basic authentication password. + final String authPassword; + + /// Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. + final String secret; + + /// Indicates if this webhook is enabled. + final bool enabled; + + /// Webhook error logs from the most recent failure. + final String logs; + + /// Number of consecutive failed webhook attempts. + final int attempts; + + Webhook({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.url, + required this.events, + required this.tls, + required this.authUsername, + required this.authPassword, + required this.secret, + required this.enabled, + required this.logs, + required this.attempts, + }); + + factory Webhook.fromMap(Map map) { + return Webhook( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + url: map['url'].toString(), + events: List.from(map['events'] ?? []), + tls: map['tls'], + authUsername: map['authUsername'].toString(), + authPassword: map['authPassword'].toString(), + secret: map['secret'].toString(), + enabled: map['enabled'], + logs: map['logs'].toString(), + attempts: map['attempts'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "url": url, + "events": events, + "tls": tls, + "authUsername": authUsername, + "authPassword": authPassword, + "secret": secret, + "enabled": enabled, + "logs": logs, + "attempts": attempts, + }; + } } diff --git a/lib/src/models/webhook_list.dart b/lib/src/models/webhook_list.dart index 5f14cbe4..2a78380b 100644 --- a/lib/src/models/webhook_list.dart +++ b/lib/src/models/webhook_list.dart @@ -2,30 +2,29 @@ part of '../../models.dart'; /// Webhooks List class WebhookList implements Model { - /// Total number of webhooks that matched your query. - final int total; + /// Total number of webhooks that matched your query. + final int total; - /// List of webhooks. - final List webhooks; + /// List of webhooks. + final List webhooks; - WebhookList({ - required this.total, - required this.webhooks, - }); + WebhookList({ + required this.total, + required this.webhooks, + }); - factory WebhookList.fromMap(Map map) { - return WebhookList( - total: map['total'], - webhooks: - List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), - ); - } + factory WebhookList.fromMap(Map map) { + return WebhookList( + total: map['total'], + webhooks: List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "webhooks": webhooks.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "webhooks": webhooks.map((p) => p.toMap()).toList(), + }; + } } diff --git a/pubspec.yaml b/pubspec.yaml index 3a0aa782..b6889c67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: dart_appwrite -version: 23.0.0 +version: 23.1.0 description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-dart diff --git a/test/query_test.dart b/test/query_test.dart index fc3749f8..9ef3843a 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -354,3 +354,4 @@ void main() { expect(query['method'], 'between'); }); } + diff --git a/test/services/account_test.dart b/test/services/account_test.dart index 727e20bb..49699ca1 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,1287 +36,1458 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Account test', () { - late MockClient client; - late Account account; + group('Account test', () { + late MockClient client; + late Account account; + + setUp(() { + client = MockClient(); + account = Account(client); + }); + + test('test method get()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.get( + ); + expect(response, isA()); - setUp(() { - client = MockClient(); - account = Account(client); - }); + }); + + test('test method create()', () async { - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.get(); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.create( - userId: '', - email: 'email@example.com', - password: '', - ); - expect(response, isA()); - }); - test('test method updateEmail()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateEmail( - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method listIdentities()', () async { - final Map data = { - 'total': 5, - 'identities': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.create( + userId: '', + email: 'email@example.com', + password: '', + ); + expect(response, isA()); - final response = await account.listIdentities(); - expect(response, isA()); - }); + }); - test('test method deleteIdentity()', () async { - final data = ''; + test('test method updateEmail()', () async { - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - final response = await account.deleteIdentity( - identityId: '', - ); - }); - test('test method createJWT()', () async { - final Map data = { - 'jwt': - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - final response = await account.createJWT(); - expect(response, isA()); - }); + final response = await account.updateEmail( + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); - test('test method listLogs()', () async { - final Map data = { - 'total': 5, - 'logs': [], - }; + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listIdentities()', () async { - final response = await account.listLogs(); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'identities': [],}; - test('test method updateMFA()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateMFA( - mfa: true, - ); - expect(response, isA()); - }); - test('test method createMfaAuthenticator()', () async { - final Map data = { - 'secret': '[SHARED_SECRET]', - 'uri': - 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createMfaAuthenticator( - type: enums.AuthenticatorType.totp, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createMFAAuthenticator()', () async { - final Map data = { - 'secret': '[SHARED_SECRET]', - 'uri': - 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createMFAAuthenticator( - type: enums.AuthenticatorType.totp, - ); - expect(response, isA()); - }); - test('test method updateMfaAuthenticator()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateMfaAuthenticator( - type: enums.AuthenticatorType.totp, - otp: '', - ); - expect(response, isA()); - }); + final response = await account.listIdentities( + ); + expect(response, isA()); - test('test method updateMFAAuthenticator()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateMFAAuthenticator( - type: enums.AuthenticatorType.totp, - otp: '', - ); - expect(response, isA()); - }); + }); - test('test method deleteMfaAuthenticator()', () async { - final data = ''; + test('test method deleteIdentity()', () async { - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final data = ''; - final response = await account.deleteMfaAuthenticator( - type: enums.AuthenticatorType.totp, - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteMFAAuthenticator()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.deleteIdentity( + identityId: '', + ); + }); - final response = await account.deleteMFAAuthenticator( - type: enums.AuthenticatorType.totp, - ); - }); + test('test method createJWT()', () async { - test('test method createMfaChallenge()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createMfaChallenge( - factor: enums.AuthenticationFactor.email, - ); - expect(response, isA()); - }); + final Map data = { + 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - test('test method createMFAChallenge()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createMFAChallenge( - factor: enums.AuthenticationFactor.email, - ); - expect(response, isA()); - }); - test('test method updateMfaChallenge()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateMfaChallenge( - challengeId: '', - otp: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateMFAChallenge()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateMFAChallenge( - challengeId: '', - otp: '', - ); - expect(response, isA()); - }); - test('test method listMfaFactors()', () async { - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - }; + final response = await account.createJWT( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await account.listMfaFactors(); - expect(response, isA()); - }); + test('test method listLogs()', () async { - test('test method listMFAFactors()', () async { - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - }; + final Map data = { + 'total': 5, + 'logs': [],}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await account.listMFAFactors(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getMfaRecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.listLogs( + ); + expect(response, isA()); - final response = await account.getMfaRecoveryCodes(); - expect(response, isA()); - }); + }); - test('test method getMFARecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + test('test method updateMFA()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - final response = await account.getMFARecoveryCodes(); - expect(response, isA()); - }); - test('test method createMfaRecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - final response = await account.createMfaRecoveryCodes(); - expect(response, isA()); - }); + final response = await account.updateMFA( + mfa: true, + ); + expect(response, isA()); - test('test method createMFARecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method createMfaAuthenticator()', () async { - final response = await account.createMFARecoveryCodes(); - expect(response, isA()); - }); + final Map data = { + 'secret': '[SHARED_SECRET]', + 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; - test('test method updateMfaRecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await account.updateMfaRecoveryCodes(); - expect(response, isA()); - }); - test('test method updateMFARecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + final response = await account.createMfaAuthenticator( + type: enums.AuthenticatorType.totp, + ); + expect(response, isA()); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await account.updateMFARecoveryCodes(); - expect(response, isA()); - }); + test('test method createMFAAuthenticator()', () async { - test('test method updateName()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateName( - name: '', - ); - expect(response, isA()); - }); + final Map data = { + 'secret': '[SHARED_SECRET]', + 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; - test('test method updatePassword()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updatePassword( - password: '', - ); - expect(response, isA()); - }); - test('test method updatePhone()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updatePhone( - phone: '+12065550100', - password: 'password', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method getPrefs()', () async { - final Map data = {}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.createMFAAuthenticator( + type: enums.AuthenticatorType.totp, + ); + expect(response, isA()); - final response = await account.getPrefs(); - expect(response, isA()); - }); + }); - test('test method updatePrefs()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updatePrefs( - prefs: {}, - ); - expect(response, isA()); - }); + test('test method updateMfaAuthenticator()', () async { - test('test method createRecovery()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createRecovery( - email: 'email@example.com', - url: 'https://example.com', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method updateRecovery()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateRecovery( - userId: '', - secret: '', - password: '', - ); - expect(response, isA()); - }); - test('test method listSessions()', () async { - final Map data = { - 'total': 5, - 'sessions': [], - }; + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await account.listSessions(); - expect(response, isA()); - }); + final response = await account.updateMfaAuthenticator( + type: enums.AuthenticatorType.totp, + otp: '', + ); + expect(response, isA()); - test('test method deleteSessions()', () async { - final data = ''; + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateMFAAuthenticator()', () async { - final response = await account.deleteSessions(); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method createAnonymousSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createAnonymousSession(); - expect(response, isA()); - }); - test('test method createEmailPasswordSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createEmailPasswordSession( - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateMagicURLSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateMagicURLSession( - userId: '', - secret: '', - ); - expect(response, isA()); - }); - test('test method updatePhoneSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updatePhoneSession( - userId: '', - secret: '', - ); - expect(response, isA()); - }); + final response = await account.updateMFAAuthenticator( + type: enums.AuthenticatorType.totp, + otp: '', + ); + expect(response, isA()); - test('test method createSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createSession( - userId: '', - secret: '', - ); - expect(response, isA()); - }); + }); - test('test method getSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.getSession( - sessionId: '', - ); - expect(response, isA()); - }); + test('test method deleteMfaAuthenticator()', () async { - test('test method updateSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateSession( - sessionId: '', - ); - expect(response, isA()); - }); + final data = ''; - test('test method deleteSession()', () async { - final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await account.deleteSession( - sessionId: '', - ); - }); + final response = await account.deleteMfaAuthenticator( + type: enums.AuthenticatorType.totp, + ); + }); - test('test method updateStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateStatus(); - expect(response, isA()); - }); + test('test method deleteMFAAuthenticator()', () async { - test('test method createEmailToken()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createEmailToken( - userId: '', - email: 'email@example.com', - ); - expect(response, isA()); - }); + final data = ''; - test('test method createMagicURLToken()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createMagicURLToken( - userId: '', - email: 'email@example.com', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method createOAuth2Token()', () async { - when(client.webAuth( - Uri(), - )).thenAnswer((_) async => 'done'); - final response = await account.createOAuth2Token( - provider: enums.OAuthProvider.amazon, - ); - expect(response, isA()); - }); + final response = await account.deleteMFAAuthenticator( + type: enums.AuthenticatorType.totp, + ); + }); + + test('test method createMfaChallenge()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMfaChallenge( + factor: enums.AuthenticationFactor.email, + ); + expect(response, isA()); + + }); + + test('test method createMFAChallenge()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMFAChallenge( + factor: enums.AuthenticationFactor.email, + ); + expect(response, isA()); + + }); + + test('test method updateMfaChallenge()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method createPhoneToken()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createPhoneToken( - userId: '', - phone: '+12065550100', - ); - expect(response, isA()); - }); - test('test method createEmailVerification()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createEmailVerification( - url: 'https://example.com', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - test('test method createVerification()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createVerification( - url: 'https://example.com', - ); - expect(response, isA()); - }); - test('test method updateEmailVerification()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateEmailVerification( - userId: '', - secret: '', - ); - expect(response, isA()); - }); + final response = await account.updateMfaChallenge( + challengeId: '', + otp: '', + ); + expect(response, isA()); - test('test method updateVerification()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updateVerification( - userId: '', - secret: '', - ); - expect(response, isA()); - }); + }); - test('test method createPhoneVerification()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.createPhoneVerification(); - expect(response, isA()); - }); + test('test method updateMFAChallenge()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMFAChallenge( + challengeId: '', + otp: '', + ); + expect(response, isA()); + + }); + + test('test method listMfaFactors()', () async { + + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.listMfaFactors( + ); + expect(response, isA()); + + }); + + test('test method listMFAFactors()', () async { + + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.listMFAFactors( + ); + expect(response, isA()); + + }); + + test('test method getMfaRecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.getMfaRecoveryCodes( + ); + expect(response, isA()); + + }); + + test('test method getMFARecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.getMFARecoveryCodes( + ); + expect(response, isA()); + + }); + + test('test method createMfaRecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMfaRecoveryCodes( + ); + expect(response, isA()); + + }); + + test('test method createMFARecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMFARecoveryCodes( + ); + expect(response, isA()); + + }); + + test('test method updateMfaRecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMfaRecoveryCodes( + ); + expect(response, isA()); + + }); + + test('test method updateMFARecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMFARecoveryCodes( + ); + expect(response, isA()); + + }); + + test('test method updateName()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateName( + name: '', + ); + expect(response, isA()); + + }); + + test('test method updatePassword()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updatePassword( + password: '', + ); + expect(response, isA()); + + }); + + test('test method updatePhone()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updatePhone( + phone: '+12065550100', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method getPrefs()', () async { + + final Map data = {}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.getPrefs( + ); + expect(response, isA()); + + }); + + test('test method updatePrefs()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updatePrefs( + prefs: {}, + ); + expect(response, isA()); + + }); + + test('test method createRecovery()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', + ); + expect(response, isA()); + + }); + + test('test method updateRecovery()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateRecovery( + userId: '', + secret: '', + password: '', + ); + expect(response, isA()); + + }); + + test('test method listSessions()', () async { + + final Map data = { + 'total': 5, + 'sessions': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.listSessions( + ); + expect(response, isA()); + + }); + + test('test method deleteSessions()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.deleteSessions( + ); + }); + + test('test method createAnonymousSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createAnonymousSession( + ); + expect(response, isA()); + + }); + + test('test method createEmailPasswordSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method updateMagicURLSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateMagicURLSession( + userId: '', + secret: '', + ); + expect(response, isA()); + + }); + + test('test method updatePhoneSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updatePhoneSession( + userId: '', + secret: '', + ); + expect(response, isA()); + + }); + + test('test method createSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createSession( + userId: '', + secret: '', + ); + expect(response, isA()); + + }); + + test('test method getSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.getSession( + sessionId: '', + ); + expect(response, isA()); + + }); + + test('test method updateSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateSession( + sessionId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteSession()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.deleteSession( + sessionId: '', + ); + }); + + test('test method updateStatus()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateStatus( + ); + expect(response, isA()); + + }); + + test('test method createEmailToken()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createEmailToken( + userId: '', + email: 'email@example.com', + ); + expect(response, isA()); + + }); + + test('test method createMagicURLToken()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createMagicURLToken( + userId: '', + email: 'email@example.com', + ); + expect(response, isA()); + + }); + + test('test method createOAuth2Token()', () async { + + when(client.webAuth( + Uri(), + )).thenAnswer((_) async => 'done'); + + + final response = await account.createOAuth2Token( + provider: enums.OAuthProvider.amazon, + ); + expect(response, isA()); + + }); + + test('test method createPhoneToken()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createPhoneToken( + userId: '', + phone: '+12065550100', + ); + expect(response, isA()); + + }); + + test('test method createEmailVerification()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createEmailVerification( + url: 'https://example.com', + ); + expect(response, isA()); + + }); + + test('test method createVerification()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createVerification( + url: 'https://example.com', + ); + expect(response, isA()); + + }); + + test('test method updateEmailVerification()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateEmailVerification( + userId: '', + secret: '', + ); + expect(response, isA()); + + }); + + test('test method updateVerification()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updateVerification( + userId: '', + secret: '', + ); + expect(response, isA()); + + }); + + test('test method createPhoneVerification()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.createPhoneVerification( + ); + expect(response, isA()); + + }); + + test('test method updatePhoneVerification()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await account.updatePhoneVerification( + userId: '', + secret: '', + ); + expect(response, isA()); + + }); - test('test method updatePhoneVerification()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await account.updatePhoneVerification( - userId: '', - secret: '', - ); - expect(response, isA()); }); - }); } diff --git a/test/services/activities_test.dart b/test/services/activities_test.dart index 7a4eead2..00196437 100644 --- a/test/services/activities_test.dart +++ b/test/services/activities_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,82 +36,86 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Activities test', () { - late MockClient client; - late Activities activities; + group('Activities test', () { + late MockClient client; + late Activities activities; - setUp(() { - client = MockClient(); - activities = Activities(client); - }); + setUp(() { + client = MockClient(); + activities = Activities(client); + }); - test('test method listEvents()', () async { - final Map data = { - 'total': 5, - 'events': [], - }; + test('test method listEvents()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'events': [],}; - final response = await activities.listEvents(); - expect(response, isA()); - }); - test('test method getEvent()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'userType': 'user', - 'userId': '610fc2f985ee0', - 'userEmail': 'john@appwrite.io', - 'userName': 'John Doe', - 'resourceParent': 'database/ID', - 'resourceType': 'collection', - 'resourceId': '610fc2f985ee0', - 'resource': 'collections/610fc2f985ee0', - 'event': 'account.sessions.create', - 'userAgent': - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', - 'ip': '127.0.0.1', - 'mode': 'admin', - 'country': 'US', - 'time': '2020-10-15T06:38:00.000+00:00', - 'projectId': '610fc2f985ee0', - 'teamId': '610fc2f985ee0', - 'hostname': 'appwrite.io', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await activities.getEvent( - eventId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await activities.listEvents( + ); + expect(response, isA()); + + }); + + test('test method getEvent()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'userType': 'user', + 'userId': '610fc2f985ee0', + 'userEmail': 'john@appwrite.io', + 'userName': 'John Doe', + 'resourceParent': 'database/ID', + 'resourceType': 'collection', + 'resourceId': '610fc2f985ee0', + 'resource': 'collections/610fc2f985ee0', + 'event': 'account.sessions.create', + 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'ip': '127.0.0.1', + 'mode': 'admin', + 'country': 'US', + 'time': '2020-10-15T06:38:00.000+00:00', + 'projectId': '610fc2f985ee0', + 'teamId': '610fc2f985ee0', + 'hostname': 'appwrite.io', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await activities.getEvent( + eventId: '', + ); + expect(response, isA()); + + }); + }); - }); } diff --git a/test/services/avatars_test.dart b/test/services/avatars_test.dart index af27d7d8..3379496e 100644 --- a/test/services/avatars_test.dart +++ b/test/services/avatars_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,123 +36,130 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Avatars test', () { - late MockClient client; - late Avatars avatars; + group('Avatars test', () { + late MockClient client; + late Avatars avatars; - setUp(() { - client = MockClient(); - avatars = Avatars(client); - }); + setUp(() { + client = MockClient(); + avatars = Avatars(client); + }); - test('test method getBrowser()', () async { - final Uint8List data = Uint8List.fromList([]); + test('test method getBrowser()', () async {final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await avatars.getBrowser( - code: enums.Browser.avantBrowser, - ); - expect(response, isA()); - }); - test('test method getCreditCard()', () async { - final Uint8List data = Uint8List.fromList([]); + final response = await avatars.getBrowser( + code: enums.Browser.avantBrowser, + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await avatars.getCreditCard( - code: enums.CreditCard.americanExpress, - ); - expect(response, isA()); - }); + test('test method getCreditCard()', () async {final Uint8List data = Uint8List.fromList([]); - test('test method getFavicon()', () async { - final Uint8List data = Uint8List.fromList([]); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await avatars.getFavicon( - url: 'https://example.com', - ); - expect(response, isA()); - }); + final response = await avatars.getCreditCard( + code: enums.CreditCard.americanExpress, + ); + expect(response, isA()); - test('test method getFlag()', () async { - final Uint8List data = Uint8List.fromList([]); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getFavicon()', () async {final Uint8List data = Uint8List.fromList([]); - final response = await avatars.getFlag( - code: enums.Flag.afghanistan, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getImage()', () async { - final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await avatars.getFavicon( + url: 'https://example.com', + ); + expect(response, isA()); - final response = await avatars.getImage( - url: 'https://example.com', - ); - expect(response, isA()); - }); + }); - test('test method getInitials()', () async { - final Uint8List data = Uint8List.fromList([]); + test('test method getFlag()', () async {final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await avatars.getInitials(); - expect(response, isA()); - }); - test('test method getQR()', () async { - final Uint8List data = Uint8List.fromList([]); + final response = await avatars.getFlag( + code: enums.Flag.afghanistan, + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); + + test('test method getImage()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await avatars.getImage( + url: 'https://example.com', + ); + expect(response, isA()); + + }); + + test('test method getInitials()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await avatars.getInitials( + ); + expect(response, isA()); + + }); + + test('test method getQR()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await avatars.getQR( + text: '', + ); + expect(response, isA()); + + }); + + test('test method getScreenshot()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await avatars.getQR( - text: '', - ); - expect(response, isA()); - }); - test('test method getScreenshot()', () async { - final Uint8List data = Uint8List.fromList([]); + final response = await avatars.getScreenshot( + url: 'https://example.com', + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await avatars.getScreenshot( - url: 'https://example.com', - ); - expect(response, isA()); }); - }); } diff --git a/test/services/backups_test.dart b/test/services/backups_test.dart index 89f7da33..bdf3684e 100644 --- a/test/services/backups_test.dart +++ b/test/services/backups_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,258 +36,293 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Backups test', () { - late MockClient client; - late Backups backups; + group('Backups test', () { + late MockClient client; + late Backups backups; - setUp(() { - client = MockClient(); - backups = Backups(client); - }); + setUp(() { + client = MockClient(); + backups = Backups(client); + }); - test('test method listArchives()', () async { - final Map data = { - 'total': 5, - 'archives': [], - }; + test('test method listArchives()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'archives': [],}; - final response = await backups.listArchives(); - expect(response, isA()); - }); - test('test method createArchive()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.createArchive( - services: [enums.BackupServices.databases], - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getArchive()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.getArchive( - archiveId: '', - ); - expect(response, isA()); - }); - test('test method deleteArchive()', () async { - final data = ''; + final response = await backups.listArchives( + ); + expect(response, isA()); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await backups.deleteArchive( - archiveId: '', - ); - }); + test('test method createArchive()', () async { - test('test method listPolicies()', () async { - final Map data = { - 'total': 5, - 'policies': [], - }; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'policyId': 'did8jx6ws45jana098ab7', + 'size': 100000, + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [],}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await backups.listPolicies(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method createPolicy()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.createPolicy( - policyId: '', - services: [enums.BackupServices.databases], - retention: 1, - schedule: '', - ); - expect(response, isA()); - }); - test('test method getPolicy()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.getPolicy( - policyId: '', - ); - expect(response, isA()); - }); + final response = await backups.createArchive( + services: [enums.BackupServices.databases], + ); + expect(response, isA()); - test('test method updatePolicy()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.updatePolicy( - policyId: '', - ); - expect(response, isA()); - }); + }); - test('test method deletePolicy()', () async { - final data = ''; + test('test method getArchive()', () async { - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'policyId': 'did8jx6ws45jana098ab7', + 'size': 100000, + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [],}; - final response = await backups.deletePolicy( - policyId: '', - ); - }); - test('test method createRestoration()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.createRestoration( - archiveId: '', - services: [enums.BackupServices.databases], - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listRestorations()', () async { - final Map data = { - 'total': 5, - 'restorations': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await backups.getArchive( + archiveId: '', + ); + expect(response, isA()); - final response = await backups.listRestorations(); - expect(response, isA()); - }); + }); + + test('test method deleteArchive()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.deleteArchive( + archiveId: '', + ); + }); + + test('test method listPolicies()', () async { + + final Map data = { + 'total': 5, + 'policies': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.listPolicies( + ); + expect(response, isA()); + + }); + + test('test method createPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true,}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.createPolicy( + policyId: '', + services: [enums.BackupServices.databases], + retention: 1, + schedule: '', + ); + expect(response, isA()); + + }); + + test('test method getPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.getPolicy( + policyId: '', + ); + expect(response, isA()); + + }); + + test('test method updatePolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.updatePolicy( + policyId: '', + ); + expect(response, isA()); + + }); + + test('test method deletePolicy()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.deletePolicy( + policyId: '', + ); + }); + + test('test method createRestoration()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'archiveId': 'did8jx6ws45jana098ab7', + 'policyId': 'did8jx6ws45jana098ab7', + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + 'options': '{databases.database[{oldId, newId, newName}]}',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.createRestoration( + archiveId: '', + services: [enums.BackupServices.databases], + ); + expect(response, isA()); + + }); + + test('test method listRestorations()', () async { + + final Map data = { + 'total': 5, + 'restorations': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.listRestorations( + ); + expect(response, isA()); + + }); + + test('test method getRestoration()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'archiveId': 'did8jx6ws45jana098ab7', + 'policyId': 'did8jx6ws45jana098ab7', + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + 'options': '{databases.database[{oldId, newId, newName}]}',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await backups.getRestoration( + restorationId: '', + ); + expect(response, isA()); + + }); - test('test method getRestoration()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await backups.getRestoration( - restorationId: '', - ); - expect(response, isA()); }); - }); } diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index 07d3f9f4..d2936e5b 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,1569 +36,1826 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Databases test', () { - late MockClient client; - late Databases databases; + group('Databases test', () { + late MockClient client; + late Databases databases; - setUp(() { - client = MockClient(); - databases = Databases(client); - }); + setUp(() { + client = MockClient(); + databases = Databases(client); + }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'databases': [], - }; + test('test method list()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'databases': [],}; - final response = await databases.list(); - expect(response, isA()); - }); - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.create( - databaseId: '', - name: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listTransactions()', () async { - final Map data = { - 'total': 5, - 'transactions': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await databases.list( + ); + expect(response, isA()); - final response = await databases.listTransactions(); - expect(response, isA()); - }); + }); - test('test method createTransaction()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createTransaction(); - expect(response, isA()); - }); + test('test method create()', () async { - test('test method getTransaction()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.getTransaction( - transactionId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; - test('test method updateTransaction()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateTransaction( - transactionId: '', - ); - expect(response, isA()); - }); - test('test method deleteTransaction()', () async { - final data = ''; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await databases.deleteTransaction( - transactionId: '', - ); - }); + final response = await databases.create( + databaseId: '', + name: '', + ); + expect(response, isA()); - test('test method createOperations()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createOperations( - transactionId: '', - ); - expect(response, isA()); - }); + }); - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.get( - databaseId: '', - ); - expect(response, isA()); - }); + test('test method listTransactions()', () async { - test('test method update()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.update( - databaseId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'transactions': [],}; - test('test method delete()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await databases.delete( - databaseId: '', - ); - }); - test('test method listCollections()', () async { - final Map data = { - 'total': 5, - 'collections': [], - }; + final response = await databases.listTransactions( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await databases.listCollections( - databaseId: '', - ); - expect(response, isA()); - }); + test('test method createTransaction()', () async { - test('test method createCollection()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createCollection( - databaseId: '', - collectionId: '', - name: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method getCollection()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.getCollection( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); - test('test method updateCollection()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500, - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateCollection( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteCollection()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await databases.createTransaction( + ); + expect(response, isA()); - final response = await databases.deleteCollection( - databaseId: '', - collectionId: '', - ); - }); + }); - test('test method listAttributes()', () async { - final Map data = { - 'total': 5, - 'attributes': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.listAttributes( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); + test('test method getTransaction()', () async { - test('test method createBooleanAttribute()', () async { - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createBooleanAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method updateBooleanAttribute()', () async { - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateBooleanAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: true, - ); - expect(response, isA()); - }); - test('test method createDatetimeAttribute()', () async { - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createDatetimeAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateDatetimeAttribute()', () async { - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateDatetimeAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '2020-10-15T06:38:00.000+00:00', - ); - expect(response, isA()); - }); - test('test method createEmailAttribute()', () async { - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createEmailAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final response = await databases.getTransaction( + transactionId: '', + ); + expect(response, isA()); - test('test method updateEmailAttribute()', () async { - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateEmailAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 'email@example.com', - ); - expect(response, isA()); - }); + }); - test('test method createEnumAttribute()', () async { - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createEnumAttribute( - databaseId: '', - collectionId: '', - key: '', - elements: [], - xrequired: true, - ); - expect(response, isA()); - }); + test('test method updateTransaction()', () async { - test('test method updateEnumAttribute()', () async { - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateEnumAttribute( - databaseId: '', - collectionId: '', - key: '', - elements: [], - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method createFloatAttribute()', () async { - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createFloatAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateFloatAttribute()', () async { - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateFloatAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 1.0, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method createIntegerAttribute()', () async { - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createIntegerAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateIntegerAttribute()', () async { - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateIntegerAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 1, - ); - expect(response, isA()); - }); + final response = await databases.updateTransaction( + transactionId: '', + ); + expect(response, isA()); - test('test method createIpAttribute()', () async { - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createIpAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + }); - test('test method updateIpAttribute()', () async { - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateIpAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + test('test method deleteTransaction()', () async { - test('test method createLineAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createLineAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final data = ''; - test('test method updateLineAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateLineAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method createLongtextAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createLongtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateLongtextAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateLongtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final response = await databases.deleteTransaction( + transactionId: '', + ); + }); - test('test method createMediumtextAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createMediumtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + test('test method createOperations()', () async { - test('test method updateMediumtextAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateMediumtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method createPointAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createPointAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updatePointAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updatePointAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method createPolygonAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createPolygonAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updatePolygonAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updatePolygonAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final response = await databases.createOperations( + transactionId: '', + ); + expect(response, isA()); - test('test method createRelationshipAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createRelationshipAttribute( - databaseId: '', - collectionId: '', - relatedCollectionId: '', - type: enums.RelationshipType.oneToOne, - ); - expect(response, isA()); - }); + }); - test('test method updateRelationshipAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateRelationshipAttribute( - databaseId: '', - collectionId: '', - key: '', - ); - expect(response, isA()); - }); + test('test method get()', () async { - test('test method createStringAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createStringAttribute( - databaseId: '', - collectionId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; - test('test method updateStringAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateStringAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); - test('test method createTextAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createTextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateTextAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateTextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); - test('test method createUrlAttribute()', () async { - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createUrlAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final response = await databases.get( + databaseId: '', + ); + expect(response, isA()); - test('test method updateUrlAttribute()', () async { - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateUrlAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 'https://example.com', - ); - expect(response, isA()); - }); + }); - test('test method createVarcharAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createVarcharAttribute( - databaseId: '', - collectionId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - }); + test('test method update()', () async { - test('test method updateVarcharAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateVarcharAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; - test('test method getAttribute()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.getAttribute( - databaseId: '', - collectionId: '', - key: '', - ); - expect(response, isA()); - }); - test('test method deleteAttribute()', () async { - final data = ''; + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await databases.deleteAttribute( - databaseId: '', - collectionId: '', - key: '', - ); - }); + final response = await databases.update( + databaseId: '', + ); + expect(response, isA()); - test('test method listDocuments()', () async { - final Map data = { - 'total': 5, - 'documents': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.listDocuments( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); + }); - test('test method createDocument()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: {}, - ); - expect(response, isA()); - }); + test('test method delete()', () async { - test('test method createDocuments()', () async { - final Map data = { - 'total': 5, - 'documents': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createDocuments( - databaseId: '', - collectionId: '', - documents: [], - ); - expect(response, isA()); - }); + final data = ''; - test('test method upsertDocuments()', () async { - final Map data = { - 'total': 5, - 'documents': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.upsertDocuments( - databaseId: '', - collectionId: '', - documents: [], - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateDocuments()', () async { - final Map data = { - 'total': 5, - 'documents': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateDocuments( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); - test('test method deleteDocuments()', () async { - final Map data = { - 'total': 5, - 'documents': [], - }; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.deleteDocuments( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); + final response = await databases.delete( + databaseId: '', + ); + }); - test('test method getDocument()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.getDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - expect(response, isA()); - }); + test('test method listCollections()', () async { - test('test method upsertDocument()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.upsertDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'collections': [],}; - test('test method updateDocument()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.updateDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - expect(response, isA()); - }); - test('test method deleteDocument()', () async { - final data = ''; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await databases.deleteDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - }); + final response = await databases.listCollections( + databaseId: '', + ); + expect(response, isA()); - test('test method decrementDocumentAttribute()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.decrementDocumentAttribute( - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - ); - expect(response, isA()); - }); + }); - test('test method incrementDocumentAttribute()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.incrementDocumentAttribute( - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - ); - expect(response, isA()); - }); + test('test method createCollection()', () async { - test('test method listIndexes()', () async { - final Map data = { - 'total': 5, - 'indexes': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.listIndexes( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; - test('test method createIndex()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.createIndex( - databaseId: '', - collectionId: '', - key: '', - type: enums.DatabasesIndexType.key, - attributes: [], - ); - expect(response, isA()); - }); - test('test method getIndex()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await databases.getIndex( - databaseId: '', - collectionId: '', - key: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createCollection( + databaseId: '', + collectionId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method getCollection()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.getCollection( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method updateCollection()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateCollection( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteCollection()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.deleteCollection( + databaseId: '', + collectionId: '', + ); + }); + + test('test method listAttributes()', () async { + + final Map data = { + 'total': 5, + 'attributes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.listAttributes( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method createBigIntAttribute()', () async { + + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateBigIntAttribute()', () async { + + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + + }); + + test('test method createBooleanAttribute()', () async { + + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createBooleanAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateBooleanAttribute()', () async { + + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateBooleanAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: true, + ); + expect(response, isA()); + + }); + + test('test method createDatetimeAttribute()', () async { + + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createDatetimeAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateDatetimeAttribute()', () async { + + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateDatetimeAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '2020-10-15T06:38:00.000+00:00', + ); + expect(response, isA()); + + }); + + test('test method createEmailAttribute()', () async { + + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createEmailAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateEmailAttribute()', () async { + + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateEmailAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 'email@example.com', + ); + expect(response, isA()); + + }); + + test('test method createEnumAttribute()', () async { + + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createEnumAttribute( + databaseId: '', + collectionId: '', + key: '', + elements: [], + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateEnumAttribute()', () async { + + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateEnumAttribute( + databaseId: '', + collectionId: '', + key: '', + elements: [], + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createFloatAttribute()', () async { + + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createFloatAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateFloatAttribute()', () async { + + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateFloatAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1.0, + ); + expect(response, isA()); + + }); + + test('test method createIntegerAttribute()', () async { + + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createIntegerAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateIntegerAttribute()', () async { + + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateIntegerAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + + }); + + test('test method createIpAttribute()', () async { + + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createIpAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateIpAttribute()', () async { + + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateIpAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createLineAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createLineAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateLineAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateLineAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method createLongtextAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateLongtextAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createMediumtextAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateMediumtextAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createPointAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createPointAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updatePointAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updatePointAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method createPolygonAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createPolygonAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updatePolygonAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updatePolygonAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method createRelationshipAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedCollection': 'collection', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createRelationshipAttribute( + databaseId: '', + collectionId: '', + relatedCollectionId: '', + type: enums.RelationshipType.oneToOne, + ); + expect(response, isA()); + + }); + + test('test method updateRelationshipAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedCollection': 'collection', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateRelationshipAttribute( + databaseId: '', + collectionId: '', + key: '', + ); + expect(response, isA()); + + }); + + test('test method createStringAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createStringAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateStringAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateStringAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createTextAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createTextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateTextAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateTextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createUrlAttribute()', () async { + + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createUrlAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateUrlAttribute()', () async { + + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateUrlAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 'https://example.com', + ); + expect(response, isA()); + + }); + + test('test method createVarcharAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateVarcharAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method getAttribute()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.getAttribute( + databaseId: '', + collectionId: '', + key: '', + ); + expect(response, isA()); + + }); + + test('test method deleteAttribute()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.deleteAttribute( + databaseId: '', + collectionId: '', + key: '', + ); + }); + + test('test method listDocuments()', () async { + + final Map data = { + 'total': 5, + 'documents': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.listDocuments( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method createDocument()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: {}, + ); + expect(response, isA()); + + }); + + test('test method createDocuments()', () async { + + final Map data = { + 'total': 5, + 'documents': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createDocuments( + databaseId: '', + collectionId: '', + documents: [], + ); + expect(response, isA()); + + }); + + test('test method upsertDocuments()', () async { + + final Map data = { + 'total': 5, + 'documents': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], + ); + expect(response, isA()); + + }); + + test('test method updateDocuments()', () async { + + final Map data = { + 'total': 5, + 'documents': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateDocuments( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteDocuments()', () async { + + final Map data = { + 'total': 5, + 'documents': [],}; + + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.deleteDocuments( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method getDocument()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.getDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + expect(response, isA()); + + }); + + test('test method upsertDocument()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.upsertDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + expect(response, isA()); + + }); + + test('test method updateDocument()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteDocument()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + }); + + test('test method decrementDocumentAttribute()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.decrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + ); + expect(response, isA()); + + }); + + test('test method incrementDocumentAttribute()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.incrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + ); + expect(response, isA()); + + }); + + test('test method listIndexes()', () async { + + final Map data = { + 'total': 5, + 'indexes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.listIndexes( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + + }); + + test('test method createIndex()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'attributes': [], + 'lengths': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.createIndex( + databaseId: '', + collectionId: '', + key: '', + type: enums.DatabasesIndexType.key, + attributes: [], + ); + expect(response, isA()); + + }); + + test('test method getIndex()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'attributes': [], + 'lengths': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await databases.getIndex( + databaseId: '', + collectionId: '', + key: '', + ); + expect(response, isA()); + + }); + + test('test method deleteIndex()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteIndex()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await databases.deleteIndex( + databaseId: '', + collectionId: '', + key: '', + ); + }); - final response = await databases.deleteIndex( - databaseId: '', - collectionId: '', - key: '', - ); }); - }); } diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index 917bc94d..89397cf4 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,770 +36,825 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Functions test', () { - late MockClient client; - late Functions functions; + group('Functions test', () { + late MockClient client; + late Functions functions; - setUp(() { - client = MockClient(); - functions = Functions(client); - }); + setUp(() { + client = MockClient(); + functions = Functions(client); + }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'functions': [], - }; + test('test method list()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'functions': [],}; - final response = await functions.list(); - expect(response, isA()); - }); - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.create( - functionId: '', - name: '', - runtime: enums.Runtime.node145, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listRuntimes()', () async { - final Map data = { - 'total': 5, - 'runtimes': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await functions.list( + ); + expect(response, isA()); - final response = await functions.listRuntimes(); - expect(response, isA()); - }); + }); - test('test method listSpecifications()', () async { - final Map data = { - 'total': 5, - 'specifications': [], - }; + test('test method create()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.create( + functionId: '', + name: '', + runtime: enums.Runtime.node145, + ); + expect(response, isA()); + + }); + + test('test method listRuntimes()', () async { + + final Map data = { + 'total': 5, + 'runtimes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.listRuntimes( + ); + expect(response, isA()); + + }); + + test('test method listSpecifications()', () async { + + final Map data = { + 'total': 5, + 'specifications': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.listSpecifications( + ); + expect(response, isA()); + + }); + + test('test method get()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.get( + functionId: '', + ); + expect(response, isA()); + + }); + + test('test method update()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.update( + functionId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.delete( + functionId: '', + ); + }); + + test('test method updateFunctionDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.updateFunctionDeployment( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method listDeployments()', () async { + + final Map data = { + 'total': 5, + 'deployments': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.listDeployments( + functionId: '', + ); + expect(response, isA()); + + }); + + test('test method createDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.chunkedUpload( + path: argThat(isNotNull), + params: argThat(isNotNull), + paramName: argThat(isNotNull), + idParamName: argThat(isNotNull), + headers: argThat(isNotNull), + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.createDeployment( + functionId: '', + code: InputFile.fromPath(path: './image.png'), + activate: true, + ); + expect(response, isA()); + + }); + + test('test method createDuplicateDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.createDuplicateDeployment( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method createTemplateDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.createTemplateDeployment( + functionId: '', + repository: '', + owner: '', + rootDirectory: '', + type: enums.TemplateReferenceType.commit, + reference: '', + ); + expect(response, isA()); + + }); + + test('test method createVcsDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.createVcsDeployment( + functionId: '', + type: enums.VCSReferenceType.branch, + reference: '', + ); + expect(response, isA()); + + }); + + test('test method getDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.getDeployment( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteDeployment()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.deleteDeployment( + functionId: '', + deploymentId: '', + ); + }); + + test('test method getDeploymentDownload()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.getDeploymentDownload( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method updateDeploymentStatus()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.updateDeploymentStatus( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method listExecutions()', () async { + + final Map data = { + 'total': 5, + 'executions': [],}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await functions.listSpecifications(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.get( - functionId: '', - ); - expect(response, isA()); - }); - test('test method update()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.update( - functionId: '', - name: '', - ); - expect(response, isA()); - }); + final response = await functions.listExecutions( + functionId: '', + ); + expect(response, isA()); - test('test method delete()', () async { - final data = ''; + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method createExecution()', () async { - final response = await functions.delete( - functionId: '', - ); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4,}; - test('test method updateFunctionDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.updateFunctionDeployment( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - }); - test('test method listDeployments()', () async { - final Map data = { - 'total': 5, - 'deployments': [], - }; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.createExecution( + functionId: '', + ); + expect(response, isA()); + + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getExecution()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4,}; - final response = await functions.listDeployments( - functionId: '', - ); - expect(response, isA()); - }); - test('test method createDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.chunkedUpload( - path: argThat(isNotNull), - params: argThat(isNotNull), - paramName: argThat(isNotNull), - idParamName: argThat(isNotNull), - headers: argThat(isNotNull), - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.createDeployment( - functionId: '', - code: InputFile.fromPath(path: './image.png'), - activate: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createDuplicateDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.createDuplicateDeployment( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - }); - test('test method createTemplateDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.createTemplateDeployment( - functionId: '', - repository: '', - owner: '', - rootDirectory: '', - type: enums.TemplateReferenceType.commit, - reference: '', - ); - expect(response, isA()); - }); + final response = await functions.getExecution( + functionId: '', + executionId: '', + ); + expect(response, isA()); - test('test method createVcsDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.createVcsDeployment( - functionId: '', - type: enums.VCSReferenceType.branch, - reference: '', - ); - expect(response, isA()); - }); + }); - test('test method getDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.getDeployment( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - }); + test('test method deleteExecution()', () async { - test('test method deleteDeployment()', () async { - final data = ''; + final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await functions.deleteDeployment( - functionId: '', - deploymentId: '', - ); - }); - test('test method getDeploymentDownload()', () async { - final Uint8List data = Uint8List.fromList([]); + final response = await functions.deleteExecution( + functionId: '', + executionId: '', + ); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listVariables()', () async { - final response = await functions.getDeploymentDownload( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'variables': [],}; - test('test method updateDeploymentStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.updateDeploymentStatus( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - }); - test('test method listExecutions()', () async { - final Map data = { - 'total': 5, - 'executions': [], - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await functions.listExecutions( - functionId: '', - ); - expect(response, isA()); - }); + final response = await functions.listVariables( + functionId: '', + ); + expect(response, isA()); - test('test method createExecution()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.createExecution( - functionId: '', - ); - expect(response, isA()); - }); + }); - test('test method getExecution()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.getExecution( - functionId: '', - executionId: '', - ); - expect(response, isA()); - }); + test('test method createVariable()', () async { - test('test method deleteExecution()', () async { - final data = ''; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await functions.deleteExecution( - functionId: '', - executionId: '', - ); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method listVariables()', () async { - final Map data = { - 'total': 5, - 'variables': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await functions.createVariable( + functionId: '', + variableId: '', + key: '', + value: '', + ); + expect(response, isA()); - final response = await functions.listVariables( - functionId: '', - ); - expect(response, isA()); - }); + }); - test('test method createVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.createVariable( - functionId: '', - key: '', - value: '', - ); - expect(response, isA()); - }); + test('test method getVariable()', () async { - test('test method getVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.getVariable( - functionId: '', - variableId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; - test('test method updateVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await functions.updateVariable( - functionId: '', - variableId: '', - key: '', - ); - expect(response, isA()); - }); - test('test method deleteVariable()', () async { - final data = ''; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.getVariable( + functionId: '', + variableId: '', + ); + expect(response, isA()); + + }); + + test('test method updateVariable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await functions.updateVariable( + functionId: '', + variableId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteVariable()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await functions.deleteVariable( + functionId: '', + variableId: '', + ); + }); - final response = await functions.deleteVariable( - functionId: '', - variableId: '', - ); }); - }); } diff --git a/test/services/graphql_test.dart b/test/services/graphql_test.dart index 0b9b9305..de918a21 100644 --- a/test/services/graphql_test.dart +++ b/test/services/graphql_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,45 +36,47 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Graphql test', () { - late MockClient client; - late Graphql graphql; + group('Graphql test', () { + late MockClient client; + late Graphql graphql; - setUp(() { - client = MockClient(); - graphql = Graphql(client); - }); + setUp(() { + client = MockClient(); + graphql = Graphql(client); + }); - test('test method query()', () async { - final data = ''; + test('test method query()', () async { - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final data = ''; - final response = await graphql.query( - query: {}, - ); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await graphql.query( + query: {}, + ); + }); + + test('test method mutation()', () async { + + final data = ''; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method mutation()', () async { - final data = ''; - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await graphql.mutation( + query: {}, + ); + }); - final response = await graphql.mutation( - query: {}, - ); }); - }); } diff --git a/test/services/health_test.dart b/test/services/health_test.dart index 87f8740d..422d690f 100644 --- a/test/services/health_test.dart +++ b/test/services/health_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,354 +36,447 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Health test', () { - late MockClient client; - late Health health; + group('Health test', () { + late MockClient client; + late Health health; - setUp(() { - client = MockClient(); - health = Health(client); - }); + setUp(() { + client = MockClient(); + health = Health(client); + }); - test('test method get()', () async { - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass', - }; + test('test method get()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; - final response = await health.get(); - expect(response, isA()); - }); - test('test method getAntivirus()', () async { - final Map data = { - 'version': '1.0.0', - 'status': 'online', - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getAntivirus(); - expect(response, isA()); - }); + final response = await health.get( + ); + expect(response, isA()); - test('test method getCache()', () async { - final Map data = { - 'total': 5, - 'statuses': [], - }; + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getAntivirus()', () async { - final response = await health.getCache(); - expect(response, isA()); - }); + final Map data = { + 'version': '1.0.0', + 'status': 'online',}; - test('test method getCertificate()', () async { - final Map data = { - 'name': '/CN=www.google.com', - 'subjectSN': '', - 'issuerOrganisation': '', - 'validFrom': '1704200998', - 'validTo': '1711458597', - 'signatureTypeSN': 'RSA-SHA256', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await health.getCertificate(); - expect(response, isA()); - }); - test('test method getConsolePausing()', () async { - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass', - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getConsolePausing(); - expect(response, isA()); - }); + final response = await health.getAntivirus( + ); + expect(response, isA()); - test('test method getDB()', () async { - final Map data = { - 'total': 5, - 'statuses': [], - }; + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getCache()', () async { - final response = await health.getDB(); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'statuses': [],}; - test('test method getPubSub()', () async { - final Map data = { - 'total': 5, - 'statuses': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await health.getPubSub(); - expect(response, isA()); - }); - test('test method getQueueAudits()', () async { - final Map data = { - 'size': 8, - }; + final response = await health.getCache( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await health.getQueueAudits(); - expect(response, isA()); - }); + test('test method getCertificate()', () async { - test('test method getQueueBuilds()', () async { - final Map data = { - 'size': 8, - }; + final Map data = { + 'name': '/CN=www.google.com', + 'subjectSN': '', + 'issuerOrganisation': '', + 'validFrom': '1704200998', + 'validTo': '1711458597', + 'signatureTypeSN': 'RSA-SHA256',}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueBuilds(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getQueueCertificates()', () async { - final Map data = { - 'size': 8, - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await health.getCertificate( + ); + expect(response, isA()); - final response = await health.getQueueCertificates(); - expect(response, isA()); - }); + }); - test('test method getQueueDatabases()', () async { - final Map data = { - 'size': 8, - }; + test('test method getConsolePausing()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; - final response = await health.getQueueDatabases(); - expect(response, isA()); - }); - test('test method getQueueDeletes()', () async { - final Map data = { - 'size': 8, - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueDeletes(); - expect(response, isA()); - }); + final response = await health.getConsolePausing( + ); + expect(response, isA()); - test('test method getFailedJobs()', () async { - final Map data = { - 'size': 8, - }; + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getDB()', () async { - final response = await health.getFailedJobs( - name: enums.Name.v1Database, - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'statuses': [],}; - test('test method getQueueFunctions()', () async { - final Map data = { - 'size': 8, - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueFunctions(); - expect(response, isA()); - }); - test('test method getQueueLogs()', () async { - final Map data = { - 'size': 8, - }; + final response = await health.getDB( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await health.getQueueLogs(); - expect(response, isA()); - }); + test('test method getPubSub()', () async { - test('test method getQueueMails()', () async { - final Map data = { - 'size': 8, - }; + final Map data = { + 'total': 5, + 'statuses': [],}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueMails(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getQueueMessaging()', () async { - final Map data = { - 'size': 8, - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await health.getPubSub( + ); + expect(response, isA()); - final response = await health.getQueueMessaging(); - expect(response, isA()); - }); + }); - test('test method getQueueMigrations()', () async { - final Map data = { - 'size': 8, - }; + test('test method getQueueAudits()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'size': 8,}; - final response = await health.getQueueMigrations(); - expect(response, isA()); - }); - test('test method getQueueStatsResources()', () async { - final Map data = { - 'size': 8, - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueStatsResources(); - expect(response, isA()); - }); + final response = await health.getQueueAudits( + ); + expect(response, isA()); - test('test method getQueueUsage()', () async { - final Map data = { - 'size': 8, - }; + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getQueueBuilds()', () async { - final response = await health.getQueueUsage(); - expect(response, isA()); - }); + final Map data = { + 'size': 8,}; - test('test method getQueueWebhooks()', () async { - final Map data = { - 'size': 8, - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueWebhooks(); - expect(response, isA()); - }); - test('test method getStorage()', () async { - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass', - }; + final response = await health.getQueueBuilds( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await health.getStorage(); - expect(response, isA()); - }); + test('test method getQueueCertificates()', () async { - test('test method getStorageLocal()', () async { - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass', - }; + final Map data = { + 'size': 8,}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await health.getStorageLocal(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueCertificates( + ); + expect(response, isA()); + + }); + + test('test method getQueueDatabases()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueDatabases( + ); + expect(response, isA()); + + }); + + test('test method getQueueDeletes()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueDeletes( + ); + expect(response, isA()); + + }); + + test('test method getFailedJobs()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getFailedJobs( + name: enums.Name.v1Database, + ); + expect(response, isA()); + + }); + + test('test method getQueueFunctions()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueFunctions( + ); + expect(response, isA()); + + }); + + test('test method getQueueLogs()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueLogs( + ); + expect(response, isA()); + + }); + + test('test method getQueueMails()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueMails( + ); + expect(response, isA()); + + }); + + test('test method getQueueMessaging()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueMessaging( + ); + expect(response, isA()); + + }); + + test('test method getQueueMigrations()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueMigrations( + ); + expect(response, isA()); + + }); + + test('test method getQueueStatsResources()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueStatsResources( + ); + expect(response, isA()); + + }); + + test('test method getQueueUsage()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueUsage( + ); + expect(response, isA()); + + }); + + test('test method getQueueWebhooks()', () async { + + final Map data = { + 'size': 8,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getQueueWebhooks( + ); + expect(response, isA()); + + }); + + test('test method getStorage()', () async { + + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getStorage( + ); + expect(response, isA()); + + }); + + test('test method getStorageLocal()', () async { + + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await health.getStorageLocal( + ); + expect(response, isA()); + + }); + + test('test method getTime()', () async { + + final Map data = { + 'remoteTime': 1639490751, + 'localTime': 1639490844, + 'diff': 93,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + - test('test method getTime()', () async { - final Map data = { - 'remoteTime': 1639490751, - 'localTime': 1639490844, - 'diff': 93, - }; + final response = await health.getTime( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await health.getTime(); - expect(response, isA()); }); - }); } diff --git a/test/services/locale_test.dart b/test/services/locale_test.dart index 11f13586..255c8730 100644 --- a/test/services/locale_test.dart +++ b/test/services/locale_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,138 +36,168 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Locale test', () { - late MockClient client; - late Locale locale; + group('Locale test', () { + late MockClient client; + late Locale locale; - setUp(() { - client = MockClient(); - locale = Locale(client); - }); + setUp(() { + client = MockClient(); + locale = Locale(client); + }); - test('test method get()', () async { - final Map data = { - 'ip': '127.0.0.1', - 'countryCode': 'US', - 'country': 'United States', - 'continentCode': 'NA', - 'continent': 'North America', - 'eu': true, - 'currency': 'USD', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await locale.get(); - expect(response, isA()); - }); + test('test method get()', () async { - test('test method listCodes()', () async { - final Map data = { - 'total': 5, - 'localeCodes': [], - }; + final Map data = { + 'ip': '127.0.0.1', + 'countryCode': 'US', + 'country': 'United States', + 'continentCode': 'NA', + 'continent': 'North America', + 'eu': true, + 'currency': 'USD',}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await locale.listCodes(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listContinents()', () async { - final Map data = { - 'total': 5, - 'continents': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await locale.get( + ); + expect(response, isA()); - final response = await locale.listContinents(); - expect(response, isA()); - }); + }); - test('test method listCountries()', () async { - final Map data = { - 'total': 5, - 'countries': [], - }; + test('test method listCodes()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'localeCodes': [],}; - final response = await locale.listCountries(); - expect(response, isA()); - }); - test('test method listCountriesEU()', () async { - final Map data = { - 'total': 5, - 'countries': [], - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await locale.listCountriesEU(); - expect(response, isA()); - }); + final response = await locale.listCodes( + ); + expect(response, isA()); - test('test method listCountriesPhones()', () async { - final Map data = { - 'total': 5, - 'phones': [], - }; + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listContinents()', () async { - final response = await locale.listCountriesPhones(); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'continents': [],}; - test('test method listCurrencies()', () async { - final Map data = { - 'total': 5, - 'currencies': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await locale.listContinents( + ); + expect(response, isA()); + + }); + + test('test method listCountries()', () async { + + final Map data = { + 'total': 5, + 'countries': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await locale.listCountries( + ); + expect(response, isA()); + + }); + + test('test method listCountriesEU()', () async { + + final Map data = { + 'total': 5, + 'countries': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await locale.listCountriesEU( + ); + expect(response, isA()); + + }); + + test('test method listCountriesPhones()', () async { + + final Map data = { + 'total': 5, + 'phones': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await locale.listCountriesPhones( + ); + expect(response, isA()); + + }); + + test('test method listCurrencies()', () async { + + final Map data = { + 'total': 5, + 'currencies': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await locale.listCurrencies( + ); + expect(response, isA()); + + }); + + test('test method listLanguages()', () async { + + final Map data = { + 'total': 5, + 'languages': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await locale.listCurrencies(); - expect(response, isA()); - }); - test('test method listLanguages()', () async { - final Map data = { - 'total': 5, - 'languages': [], - }; + final response = await locale.listLanguages( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await locale.listLanguages(); - expect(response, isA()); }); - }); } diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index bc1490fc..21352984 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,1216 +36,1381 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Messaging test', () { - late MockClient client; - late Messaging messaging; + group('Messaging test', () { + late MockClient client; + late Messaging messaging; - setUp(() { - client = MockClient(); - messaging = Messaging(client); - }); + setUp(() { + client = MockClient(); + messaging = Messaging(client); + }); - test('test method listMessages()', () async { - final Map data = { - 'total': 5, - 'messages': [], - }; + test('test method listMessages()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'messages': [],}; - final response = await messaging.listMessages(); - expect(response, isA()); - }); - test('test method createEmail()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createEmail( - messageId: '', - subject: '', - content: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateEmail()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateEmail( - messageId: '', - ); - expect(response, isA()); - }); - test('test method createPush()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createPush( - messageId: '', - ); - expect(response, isA()); - }); + final response = await messaging.listMessages( + ); + expect(response, isA()); - test('test method updatePush()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updatePush( - messageId: '', - ); - expect(response, isA()); - }); + }); - test('test method createSms()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createSms( - messageId: '', - content: '', - ); - expect(response, isA()); - }); + test('test method createEmail()', () async { - test('test method createSMS()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createSMS( - messageId: '', - content: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - test('test method updateSms()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateSms( - messageId: '', - ); - expect(response, isA()); - }); - test('test method updateSMS()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateSMS( - messageId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method getMessage()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.getMessage( - messageId: '', - ); - expect(response, isA()); - }); - test('test method delete()', () async { - final data = ''; + final response = await messaging.createEmail( + messageId: '', + subject: '', + content: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await messaging.delete( - messageId: '', - ); - }); + test('test method updateEmail()', () async { - test('test method listMessageLogs()', () async { - final Map data = { - 'total': 5, - 'logs': [], - }; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.listMessageLogs( - messageId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method listTargets()', () async { - final Map data = { - 'total': 5, - 'targets': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.updateEmail( + messageId: '', + ); + expect(response, isA()); - final response = await messaging.listTargets( - messageId: '', - ); - expect(response, isA()); - }); + }); - test('test method listProviders()', () async { - final Map data = { - 'total': 5, - 'providers': [], - }; + test('test method createPush()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - final response = await messaging.listProviders(); - expect(response, isA()); - }); - test('test method createApnsProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createApnsProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method createAPNSProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createAPNSProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method updateApnsProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateApnsProvider( - providerId: '', - ); - expect(response, isA()); - }); + final response = await messaging.createPush( + messageId: '', + ); + expect(response, isA()); - test('test method updateAPNSProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateAPNSProvider( - providerId: '', - ); - expect(response, isA()); - }); + }); - test('test method createFcmProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createFcmProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + test('test method updatePush()', () async { - test('test method createFCMProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createFCMProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - test('test method updateFcmProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateFcmProvider( - providerId: '', - ); - expect(response, isA()); - }); - test('test method updateFCMProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateFCMProvider( - providerId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method createMailgunProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createMailgunProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method updateMailgunProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateMailgunProvider( - providerId: '', - ); - expect(response, isA()); - }); + final response = await messaging.updatePush( + messageId: '', + ); + expect(response, isA()); + + }); - test('test method createMsg91Provider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createMsg91Provider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + test('test method createSms()', () async { - test('test method updateMsg91Provider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateMsg91Provider( - providerId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - test('test method createResendProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createResendProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method updateResendProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateResendProvider( - providerId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method createSendgridProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createSendgridProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method updateSendgridProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateSendgridProvider( - providerId: '', - ); - expect(response, isA()); - }); + final response = await messaging.createSms( + messageId: '', + content: '', + ); + expect(response, isA()); - test('test method createSmtpProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createSmtpProvider( - providerId: '', - name: '', - host: '', - ); - expect(response, isA()); - }); + }); - test('test method createSMTPProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createSMTPProvider( - providerId: '', - name: '', - host: '', - ); - expect(response, isA()); - }); + test('test method createSMS()', () async { - test('test method updateSmtpProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateSmtpProvider( - providerId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - test('test method updateSMTPProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateSMTPProvider( - providerId: '', - ); - expect(response, isA()); - }); - test('test method createTelesignProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createTelesignProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateTelesignProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateTelesignProvider( - providerId: '', - ); - expect(response, isA()); - }); - test('test method createTextmagicProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createTextmagicProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + final response = await messaging.createSMS( + messageId: '', + content: '', + ); + expect(response, isA()); - test('test method updateTextmagicProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateTextmagicProvider( - providerId: '', - ); - expect(response, isA()); - }); + }); - test('test method createTwilioProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createTwilioProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); + test('test method updateSms()', () async { - test('test method updateTwilioProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateTwilioProvider( - providerId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - test('test method createVonageProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createVonageProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method updateVonageProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateVonageProvider( - providerId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method getProvider()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {}, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.getProvider( - providerId: '', - ); - expect(response, isA()); - }); - test('test method deleteProvider()', () async { - final data = ''; + final response = await messaging.updateSms( + messageId: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await messaging.deleteProvider( - providerId: '', - ); - }); + test('test method updateSMS()', () async { - test('test method listProviderLogs()', () async { - final Map data = { - 'total': 5, - 'logs': [], - }; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.listProviderLogs( - providerId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method listSubscriberLogs()', () async { - final Map data = { - 'total': 5, - 'logs': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.updateSMS( + messageId: '', + ); + expect(response, isA()); - final response = await messaging.listSubscriberLogs( - subscriberId: '', - ); - expect(response, isA()); - }); + }); - test('test method listTopics()', () async { - final Map data = { - 'total': 5, - 'topics': [], - }; + test('test method getMessage()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; - final response = await messaging.listTopics(); - expect(response, isA()); - }); - test('test method createTopic()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createTopic( - topicId: '', - name: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getTopic()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.getTopic( - topicId: '', - ); - expect(response, isA()); - }); - test('test method updateTopic()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.updateTopic( - topicId: '', - ); - expect(response, isA()); - }); + final response = await messaging.getMessage( + messageId: '', + ); + expect(response, isA()); - test('test method deleteTopic()', () async { - final data = ''; + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method delete()', () async { - final response = await messaging.deleteTopic( - topicId: '', - ); - }); + final data = ''; - test('test method listTopicLogs()', () async { - final Map data = { - 'total': 5, - 'logs': [], - }; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.listTopicLogs( - topicId: '', - ); - expect(response, isA()); - }); + final response = await messaging.delete( + messageId: '', + ); + }); - test('test method listSubscribers()', () async { - final Map data = { - 'total': 5, - 'subscribers': [], - }; + test('test method listMessageLogs()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'logs': [],}; - final response = await messaging.listSubscribers( - topicId: '', - ); - expect(response, isA()); - }); - test('test method createSubscriber()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.createSubscriber( - topicId: '', - subscriberId: '', - targetId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getSubscriber()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await messaging.getSubscriber( - topicId: '', - subscriberId: '', - ); - expect(response, isA()); - }); - test('test method deleteSubscriber()', () async { - final data = ''; + final response = await messaging.listMessageLogs( + messageId: '', + ); + expect(response, isA()); + + }); + + test('test method listTargets()', () async { + + final Map data = { + 'total': 5, + 'targets': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listTargets( + messageId: '', + ); + expect(response, isA()); + + }); + + test('test method listProviders()', () async { + + final Map data = { + 'total': 5, + 'providers': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listProviders( + ); + expect(response, isA()); + + }); + + test('test method createApnsProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createApnsProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method createAPNSProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createAPNSProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateApnsProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateApnsProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method updateAPNSProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateAPNSProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createFcmProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createFcmProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method createFCMProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createFCMProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateFcmProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateFcmProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method updateFCMProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateFCMProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createMailgunProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createMailgunProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateMailgunProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateMailgunProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createMsg91Provider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createMsg91Provider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateMsg91Provider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateMsg91Provider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createResendProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createResendProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateResendProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateResendProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createSendgridProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSendgridProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateSendgridProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateSendgridProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createSmtpProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSmtpProvider( + providerId: '', + name: '', + host: '', + ); + expect(response, isA()); + + }); + + test('test method createSMTPProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSMTPProvider( + providerId: '', + name: '', + host: '', + ); + expect(response, isA()); + + }); + + test('test method updateSmtpProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateSmtpProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method updateSMTPProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateSMTPProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createTelesignProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTelesignProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateTelesignProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTelesignProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createTextmagicProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTextmagicProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateTextmagicProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTextmagicProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createTwilioProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTwilioProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateTwilioProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTwilioProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method createVonageProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createVonageProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updateVonageProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateVonageProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method getProvider()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getProvider( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteProvider()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.deleteProvider( + providerId: '', + ); + }); + + test('test method listProviderLogs()', () async { + + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listProviderLogs( + providerId: '', + ); + expect(response, isA()); + + }); + + test('test method listSubscriberLogs()', () async { + + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listSubscriberLogs( + subscriberId: '', + ); + expect(response, isA()); + + }); + + test('test method listTopics()', () async { + + final Map data = { + 'total': 5, + 'topics': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listTopics( + ); + expect(response, isA()); + + }); + + test('test method createTopic()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createTopic( + topicId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method getTopic()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getTopic( + topicId: '', + ); + expect(response, isA()); + + }); + + test('test method updateTopic()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.updateTopic( + topicId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteTopic()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.deleteTopic( + topicId: '', + ); + }); + + test('test method listTopicLogs()', () async { + + final Map data = { + 'total': 5, + 'logs': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listTopicLogs( + topicId: '', + ); + expect(response, isA()); + + }); + + test('test method listSubscribers()', () async { + + final Map data = { + 'total': 5, + 'subscribers': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.listSubscribers( + topicId: '', + ); + expect(response, isA()); + + }); + + test('test method createSubscriber()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.createSubscriber( + topicId: '', + subscriberId: '', + targetId: '', + ); + expect(response, isA()); + + }); + + test('test method getSubscriber()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await messaging.getSubscriber( + topicId: '', + subscriberId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteSubscriber()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.deleteSubscriber( + topicId: '', + subscriberId: '', + ); + }); - final response = await messaging.deleteSubscriber( - topicId: '', - subscriberId: '', - ); }); - }); } diff --git a/test/services/presences_test.dart b/test/services/presences_test.dart new file mode 100644 index 00000000..fd6d10b2 --- /dev/null +++ b/test/services/presences_test.dart @@ -0,0 +1,164 @@ +import 'package:test/test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:dart_appwrite/models.dart' as models; +import 'package:dart_appwrite/enums.dart' as enums; +import 'package:dart_appwrite/src/enums.dart'; +import 'package:dart_appwrite/src/response.dart'; +import 'dart:typed_data'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +class MockClient extends Mock implements Client { + Map config = {'project': 'testproject'}; + String endPoint = 'https://localhost/v1'; + @override + Future call( + HttpMethod? method, { + String path = '', + Map headers = const {}, + Map params = const {}, + ResponseType? responseType, + }) async { + return super.noSuchMethod(Invocation.method(#call, [method]), + returnValue: Response()); + } + + @override + Future webAuth(Uri url) async { + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + } + + @override + Future chunkedUpload({ + String? path, + Map? params, + String? paramName, + String? idParamName, + Map? headers, + Function(UploadProgress)? onProgress, + }) async { + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + } +} + +void main() { + group('Presences test', () { + late MockClient client; + late Presences presences; + + setUp(() { + client = MockClient(); + presences = Presences(client); + }); + + test('test method list()', () async { + + final Map data = { + 'total': 5, + 'presences': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await presences.list( + ); + expect(response, isA()); + + }); + + test('test method get()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await presences.get( + presenceId: '', + ); + expect(response, isA()); + + }); + + test('test method upsert()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await presences.upsert( + presenceId: '', + userId: '', + status: '', + ); + expect(response, isA()); + + }); + + test('test method updatePresence()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await presences.updatePresence( + presenceId: '', + userId: '', + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await presences.delete( + presenceId: '', + ); + }); + + }); +} diff --git a/test/services/project_test.dart b/test/services/project_test.dart index 259d864c..a2764af6 100644 --- a/test/services/project_test.dart +++ b/test/services/project_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,785 +36,3201 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Project test', () { - late MockClient client; - late Project project; + group('Project test', () { + late MockClient client; + late Project project; + + setUp(() { + client = MockClient(); + project = Project(client); + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.delete( + ); + }); + + test('test method updateAuthMethod()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateAuthMethod( + methodId: enums.MethodId.emailPassword, + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method listKeys()', () async { + + final Map data = { + 'total': 5, + 'keys': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.listKeys( + ); + expect(response, isA()); + + }); + + test('test method createKey()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createKey( + keyId: '', + name: '', + scopes: [enums.Scopes.projectRead], + ); + expect(response, isA()); + + }); + + test('test method createEphemeralKey()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createEphemeralKey( + scopes: [enums.Scopes.projectRead], + duration: 1, + ); + expect(response, isA()); + + }); + + test('test method getKey()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.getKey( + keyId: '', + ); + expect(response, isA()); + + }); + + test('test method updateKey()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateKey( + keyId: '', + name: '', + scopes: [enums.Scopes.projectRead], + ); + expect(response, isA()); + + }); + + test('test method deleteKey()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.deleteKey( + keyId: '', + ); + }); + + test('test method updateLabels()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateLabels( + labels: [], + ); + expect(response, isA()); + + }); + + test('test method listMockPhones()', () async { + + final Map data = { + 'total': 5, + 'mockNumbers': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.listMockPhones( + ); + expect(response, isA()); + + }); + + test('test method createMockPhone()', () async { + + final Map data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - setUp(() { - client = MockClient(); - project = Project(client); - }); - test('test method listKeys()', () async { - final Map data = { - 'total': 5, - 'keys': [], - }; + final response = await project.createMockPhone( + number: '+12065550100', + otp: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await project.listKeys(); - expect(response, isA()); - }); + test('test method getMockPhone()', () async { - test('test method createKey()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createKey( - keyId: '', - name: '', - scopes: [enums.Scopes.sessionsWrite], - ); - expect(response, isA()); - }); + final Map data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method getKey()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.getKey( - keyId: '', - ); - expect(response, isA()); - }); - test('test method updateKey()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateKey( - keyId: '', - name: '', - scopes: [enums.Scopes.sessionsWrite], - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteKey()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.getMockPhone( + number: '+12065550100', + ); + expect(response, isA()); - final response = await project.deleteKey( - keyId: '', - ); - }); + }); - test('test method updateLabels()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyTo': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'securepassword', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateLabels( - labels: [], - ); - expect(response, isA()); - }); + test('test method updateMockPhone()', () async { - test('test method listPlatforms()', () async { - final Map data = { - 'total': 5, - 'platforms': [], - }; + final Map data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await project.listPlatforms(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - test('test method createAndroidPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createAndroidPlatform( - platformId: '', - name: '', - applicationId: '', - ); - expect(response, isA()); - }); - test('test method updateAndroidPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateAndroidPlatform( - platformId: '', - name: '', - applicationId: '', - ); - expect(response, isA()); - }); + final response = await project.updateMockPhone( + number: '+12065550100', + otp: '', + ); + expect(response, isA()); - test('test method createApplePlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createApplePlatform( - platformId: '', - name: '', - bundleIdentifier: '', - ); - expect(response, isA()); - }); + }); - test('test method updateApplePlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateApplePlatform( - platformId: '', - name: '', - bundleIdentifier: '', - ); - expect(response, isA()); - }); + test('test method deleteMockPhone()', () async { - test('test method createLinuxPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createLinuxPlatform( - platformId: '', - name: '', - packageName: '', - ); - expect(response, isA()); - }); + final data = ''; - test('test method updateLinuxPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateLinuxPlatform( - platformId: '', - name: '', - packageName: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method createWebPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createWebPlatform( - platformId: '', - name: '', - hostname: 'app.example.com', - ); - expect(response, isA()); - }); - test('test method updateWebPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateWebPlatform( - platformId: '', - name: '', - hostname: 'app.example.com', - ); - expect(response, isA()); - }); + final response = await project.deleteMockPhone( + number: '+12065550100', + ); + }); - test('test method createWindowsPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createWindowsPlatform( - platformId: '', - name: '', - packageIdentifierName: '', - ); - expect(response, isA()); - }); + test('test method listOAuth2Providers()', () async { - test('test method updateWindowsPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateWindowsPlatform( - platformId: '', - name: '', - packageIdentifierName: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'providers': [],}; - test('test method getPlatform()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.getPlatform( - platformId: '', - ); - expect(response, isA()); - }); - test('test method deletePlatform()', () async { - final data = ''; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await project.deletePlatform( - platformId: '', - ); - }); + final response = await project.listOAuth2Providers( + ); + expect(response, isA()); - test('test method updateProtocolStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyTo': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'securepassword', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateProtocolStatus( - protocolId: enums.ProtocolId.rest, - enabled: true, - ); - expect(response, isA()); - }); + }); - test('test method updateServiceStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyTo': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': 'securepassword', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateServiceStatus( - serviceId: enums.ServiceId.account, - enabled: true, - ); - expect(response, isA()); - }); + test('test method getOAuth2Provider()', () async { - test('test method listVariables()', () async { - final Map data = { - 'total': 5, - 'variables': [], - }; + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common',}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await project.listVariables(); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.createVariable( - variableId: '', - key: '', - value: '', - ); - expect(response, isA()); - }); - test('test method getVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.getVariable( - variableId: '', - ); - expect(response, isA()); - }); + final response = await project.getOAuth2Provider( + providerId: enums.ProviderId.amazon, + ); + expect(response, isA()); - test('test method updateVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await project.updateVariable( - variableId: '', - ); - expect(response, isA()); - }); + }); + + test('test method updateOAuth2Amazon()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Amazon( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Apple()', () async { + + final Map data = { + '\$id': 'apple', + 'enabled': true, + 'serviceId': 'ip.appwrite.app.web', + 'keyId': 'P4000000N8', + 'teamId': 'D4000000R6', + 'p8File': '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Apple( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Auth0()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'OaOkIA000000000000000000005KLSYq', + 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + 'endpoint': 'example.us.auth0.com',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Auth0( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Authentik()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', + 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + 'endpoint': 'example.authentik.com',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Authentik( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Autodesk()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '5zw90v00000000000000000000kVYXN7', + 'clientSecret': '7I000000000000MW',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Autodesk( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Bitbucket()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'key': 'Knt70000000000ByRc', + 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Bitbucket( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Bitly()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'd95151000000000000000000000000000067af9b', + 'clientSecret': 'a13e250000000000000000000000000000d73095',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Bitly( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Box()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'deglcs00000000000000000000x2og6y', + 'clientSecret': 'OKM1f100000000000000000000eshEif',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Box( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Dailymotion()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'apiKey': '07a9000000000000067f', + 'apiSecret': 'a399a90000000000000000000000000000d90639',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Dailymotion( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Discord()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '950722000000343754', + 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Discord( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Disqus()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Disqus( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Dropbox()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'appKey': 'jl000000000009t', + 'appSecret': 'g200000000000vw',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Dropbox( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Etsy()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'keyString': 'nsgzxh0000000000008j85a2', + 'sharedSecret': 'tp000000ru',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Etsy( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Facebook()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'appId': '260600000007694', + 'appSecret': '2d0b2800000000000000000000d38af4',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Facebook( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Figma()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'byay5H0000000000VtiI40', + 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Figma( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2FusionAuth()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'b2222c00-0000-0000-0000-000000862097', + 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', + 'endpoint': 'example.fusionauth.io',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2FusionAuth( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2GitHub()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'e4d87900000000540733', + 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2GitHub( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Gitlab()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + 'endpoint': 'https://gitlab.com',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Gitlab( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Google()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'your-google-client-id.apps.googleusercontent.com', + 'clientSecret': 'your-google-client-secret',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Google( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Keycloak()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-o0000000st-app', + 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', + 'endpoint': 'keycloak.example.com', + 'realmName': 'appwrite-realm',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Keycloak( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Kick()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '01KQ7C00000000000001MFHS32', + 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Kick( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Linkedin()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '770000000000dv', + 'primaryClientSecret': 'your-linkedin-client-secret',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Linkedin( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Microsoft()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Microsoft( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Notion()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', + 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Notion( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Oidc()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', + 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', + 'authorizationURL': 'https://myoauth.com/oauth2/authorize', + 'tokenURL': 'https://myoauth.com/oauth2/token', + 'userInfoURL': 'https://myoauth.com/oauth2/userinfo',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Oidc( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Okta()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '0oa00000000000000698', + 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + 'domain': 'trial-6400025.okta.com', + 'authorizationServerId': 'aus000000000000000h7z',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Okta( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Paypal()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Paypal( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2PaypalSandbox()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2PaypalSandbox( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Podio()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-oauth-test-app', + 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Podio( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Salesforce()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + 'customerSecret': '3w000000000000e2',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Salesforce( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Slack()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '23000000089.15000000000023', + 'clientSecret': '81656000000000000000000000f3d2fd',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Slack( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Spotify()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6ec271000000000000000000009beace', + 'clientSecret': 'db068a000000000000000000008b5b9f',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Spotify( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Stripe()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'ca_UKibXX0000000000000000000006byvR', + 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Stripe( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Tradeshift()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Tradeshift( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2TradeshiftSandbox()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2TradeshiftSandbox( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Twitch()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'vvi0in000000000000000000ikmt9p', + 'clientSecret': 'pmapue000000000000000000zylw3v',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Twitch( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2WordPress()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '130005', + 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2WordPress( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2X()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': 'slzZV0000000000000NFLaWT', + 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2X( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Yahoo()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Yahoo( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Yandex()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6a8a6a0000000000000000000091483c', + 'clientSecret': 'bbf98500000000000000000000c75a63',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Yandex( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Zoho()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '1000.83C178000000000000000000RPNX0B', + 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Zoho( + ); + expect(response, isA()); + + }); + + test('test method updateOAuth2Zoom()', () async { + + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'QMAC00000000000000w0AQ', + 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateOAuth2Zoom( + ); + expect(response, isA()); + + }); + + test('test method listPlatforms()', () async { + + final Map data = { + 'total': 5, + 'platforms': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.listPlatforms( + ); + expect(response, isA()); + + }); + + test('test method createAndroidPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createAndroidPlatform( + platformId: '', + name: '', + applicationId: '', + ); + expect(response, isA()); + + }); + + test('test method updateAndroidPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateAndroidPlatform( + platformId: '', + name: '', + applicationId: '', + ); + expect(response, isA()); + + }); + + test('test method createApplePlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createApplePlatform( + platformId: '', + name: '', + bundleIdentifier: '', + ); + expect(response, isA()); + + }); + + test('test method updateApplePlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateApplePlatform( + platformId: '', + name: '', + bundleIdentifier: '', + ); + expect(response, isA()); + + }); + + test('test method createLinuxPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createLinuxPlatform( + platformId: '', + name: '', + packageName: '', + ); + expect(response, isA()); + + }); + + test('test method updateLinuxPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateLinuxPlatform( + platformId: '', + name: '', + packageName: '', + ); + expect(response, isA()); + + }); + + test('test method createWebPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createWebPlatform( + platformId: '', + name: '', + hostname: 'app.example.com', + ); + expect(response, isA()); + + }); + + test('test method updateWebPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateWebPlatform( + platformId: '', + name: '', + hostname: 'app.example.com', + ); + expect(response, isA()); + + }); + + test('test method createWindowsPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createWindowsPlatform( + platformId: '', + name: '', + packageIdentifierName: '', + ); + expect(response, isA()); + + }); + + test('test method updateWindowsPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateWindowsPlatform( + platformId: '', + name: '', + packageIdentifierName: '', + ); + expect(response, isA()); + + }); + + test('test method getPlatform()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.getPlatform( + platformId: '', + ); + expect(response, isA()); + + }); + + test('test method deletePlatform()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.deletePlatform( + platformId: '', + ); + }); + + test('test method listPolicies()', () async { + + final Map data = { + 'total': 9, + 'policies': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.listPolicies( + ); + expect(response, isA()); + + }); + + test('test method updateMembershipPrivacyPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateMembershipPrivacyPolicy( + ); + expect(response, isA()); + + }); + + test('test method updatePasswordDictionaryPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updatePasswordDictionaryPolicy( + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method updatePasswordHistoryPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updatePasswordHistoryPolicy( + total: 1, + ); + expect(response, isA()); + + }); + + test('test method updatePasswordPersonalDataPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updatePasswordPersonalDataPolicy( + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method updateSessionAlertPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateSessionAlertPolicy( + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method updateSessionDurationPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateSessionDurationPolicy( + duration: 1, + ); + expect(response, isA()); + + }); + + test('test method updateSessionInvalidationPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateSessionInvalidationPolicy( + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method updateSessionLimitPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateSessionLimitPolicy( + total: 1, + ); + expect(response, isA()); + + }); + + test('test method updateUserLimitPolicy()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateUserLimitPolicy( + total: 1, + ); + expect(response, isA()); + + }); + + test('test method getPolicy()', () async { + + final Map data = { + '\$id': 'password-dictionary', + 'userId': true, + 'userEmail': true, + 'userPhone': true, + 'userName': true, + 'userMFA': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.getPolicy( + policyId: enums.PolicyId.passwordDictionary, + ); + expect(response, isA()); + + }); + + test('test method updateProtocol()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateProtocol( + protocolId: enums.ProtocolId.rest, + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method updateService()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateService( + serviceId: enums.ServiceId.account, + enabled: true, + ); + expect(response, isA()); + + }); + + test('test method updateSMTP()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateSMTP( + ); + expect(response, isA()); + + }); + + test('test method createSMTPTest()', () async { + + final data = ''; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createSMTPTest( + emails: [], + ); + }); + + test('test method listEmailTemplates()', () async { + + final Map data = { + 'total': 5, + 'templates': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.listEmailTemplates( + ); + expect(response, isA()); + + }); + + test('test method updateEmailTemplate()', () async { + + final Map data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateEmailTemplate( + templateId: enums.EmailTemplateType.verification, + ); + expect(response, isA()); + + }); + + test('test method getEmailTemplate()', () async { + + final Map data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.getEmailTemplate( + templateId: enums.EmailTemplateType.verification, + ); + expect(response, isA()); + + }); + + test('test method listVariables()', () async { + + final Map data = { + 'total': 5, + 'variables': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.listVariables( + ); + expect(response, isA()); + + }); + + test('test method createVariable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.createVariable( + variableId: '', + key: '', + value: '', + ); + expect(response, isA()); + + }); + + test('test method getVariable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.getVariable( + variableId: '', + ); + expect(response, isA()); + + }); + + test('test method updateVariable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await project.updateVariable( + variableId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteVariable()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteVariable()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.deleteVariable( + variableId: '', + ); + }); - final response = await project.deleteVariable( - variableId: '', - ); }); - }); } diff --git a/test/services/proxy_test.dart b/test/services/proxy_test.dart new file mode 100644 index 00000000..f22b0a33 --- /dev/null +++ b/test/services/proxy_test.dart @@ -0,0 +1,278 @@ +import 'package:test/test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:dart_appwrite/models.dart' as models; +import 'package:dart_appwrite/enums.dart' as enums; +import 'package:dart_appwrite/src/enums.dart'; +import 'package:dart_appwrite/src/response.dart'; +import 'dart:typed_data'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +class MockClient extends Mock implements Client { + Map config = {'project': 'testproject'}; + String endPoint = 'https://localhost/v1'; + @override + Future call( + HttpMethod? method, { + String path = '', + Map headers = const {}, + Map params = const {}, + ResponseType? responseType, + }) async { + return super.noSuchMethod(Invocation.method(#call, [method]), + returnValue: Response()); + } + + @override + Future webAuth(Uri url) async { + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + } + + @override + Future chunkedUpload({ + String? path, + Map? params, + String? paramName, + String? idParamName, + Map? headers, + Function(UploadProgress)? onProgress, + }) async { + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + } +} + +void main() { + group('Proxy test', () { + late MockClient client; + late Proxy proxy; + + setUp(() { + client = MockClient(); + proxy = Proxy(client); + }); + + test('test method listRules()', () async { + + final Map data = { + 'total': 5, + 'rules': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.listRules( + ); + expect(response, isA()); + + }); + + test('test method createAPIRule()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.createAPIRule( + domain: '', + ); + expect(response, isA()); + + }); + + test('test method createFunctionRule()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.createFunctionRule( + domain: '', + functionId: '', + ); + expect(response, isA()); + + }); + + test('test method createRedirectRule()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.createRedirectRule( + domain: '', + url: 'https://example.com', + statusCode: enums.StatusCode.movedPermanently301, + resourceId: '', + resourceType: enums.ProxyResourceType.site, + ); + expect(response, isA()); + + }); + + test('test method createSiteRule()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.createSiteRule( + domain: '', + siteId: '', + ); + expect(response, isA()); + + }); + + test('test method getRule()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.getRule( + ruleId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteRule()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.deleteRule( + ruleId: '', + ); + }); + + test('test method updateRuleStatus()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await proxy.updateRuleStatus( + ruleId: '', + ); + expect(response, isA()); + + }); + + }); +} diff --git a/test/services/sites_test.dart b/test/services/sites_test.dart index 208a16b7..0815eaa3 100644 --- a/test/services/sites_test.dart +++ b/test/services/sites_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,748 +36,800 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Sites test', () { - late MockClient client; - late Sites sites; + group('Sites test', () { + late MockClient client; + late Sites sites; - setUp(() { - client = MockClient(); - sites = Sites(client); - }); + setUp(() { + client = MockClient(); + sites = Sites(client); + }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'sites': [], - }; + test('test method list()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'sites': [],}; - final response = await sites.list(); - expect(response, isA()); - }); - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.create( - siteId: '', - name: '', - framework: enums.Framework.analog, - buildRuntime: enums.BuildRuntime.node145, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listFrameworks()', () async { - final Map data = { - 'total': 5, - 'frameworks': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await sites.list( + ); + expect(response, isA()); - final response = await sites.listFrameworks(); - expect(response, isA()); - }); + }); - test('test method listSpecifications()', () async { - final Map data = { - 'total': 5, - 'specifications': [], - }; + test('test method create()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.create( + siteId: '', + name: '', + framework: enums.Framework.analog, + buildRuntime: enums.BuildRuntime.node145, + ); + expect(response, isA()); + + }); + + test('test method listFrameworks()', () async { + + final Map data = { + 'total': 5, + 'frameworks': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.listFrameworks( + ); + expect(response, isA()); + + }); + + test('test method listSpecifications()', () async { + + final Map data = { + 'total': 5, + 'specifications': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.listSpecifications( + ); + expect(response, isA()); + + }); + + test('test method get()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.get( + siteId: '', + ); + expect(response, isA()); + + }); + + test('test method update()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.update( + siteId: '', + name: '', + framework: enums.Framework.analog, + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.delete( + siteId: '', + ); + }); + + test('test method updateSiteDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.updateSiteDeployment( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method listDeployments()', () async { + + final Map data = { + 'total': 5, + 'deployments': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.listDeployments( + siteId: '', + ); + expect(response, isA()); + + }); + + test('test method createDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.chunkedUpload( + path: argThat(isNotNull), + params: argThat(isNotNull), + paramName: argThat(isNotNull), + idParamName: argThat(isNotNull), + headers: argThat(isNotNull), + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.createDeployment( + siteId: '', + code: InputFile.fromPath(path: './image.png'), + ); + expect(response, isA()); + + }); + + test('test method createDuplicateDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.createDuplicateDeployment( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method createTemplateDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.createTemplateDeployment( + siteId: '', + repository: '', + owner: '', + rootDirectory: '', + type: enums.TemplateReferenceType.branch, + reference: '', + ); + expect(response, isA()); + + }); + + test('test method createVcsDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.createVcsDeployment( + siteId: '', + type: enums.VCSReferenceType.branch, + reference: '', + ); + expect(response, isA()); + + }); + + test('test method getDeployment()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.getDeployment( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteDeployment()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.deleteDeployment( + siteId: '', + deploymentId: '', + ); + }); + + test('test method getDeploymentDownload()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.getDeploymentDownload( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + + }); + + test('test method updateDeploymentStatus()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await sites.listSpecifications(); - expect(response, isA()); - }); + final response = await sites.updateDeploymentStatus( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.get( - siteId: '', - ); - expect(response, isA()); - }); + }); - test('test method update()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.update( - siteId: '', - name: '', - framework: enums.Framework.analog, - ); - expect(response, isA()); - }); + test('test method listLogs()', () async { - test('test method delete()', () async { - final data = ''; + final Map data = { + 'total': 5, + 'executions': [],}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await sites.delete( - siteId: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateSiteDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.updateSiteDeployment( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - }); - test('test method listDeployments()', () async { - final Map data = { - 'total': 5, - 'deployments': [], - }; + final response = await sites.listLogs( + siteId: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await sites.listDeployments( - siteId: '', - ); - expect(response, isA()); - }); + test('test method getLog()', () async { - test('test method createDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.chunkedUpload( - path: argThat(isNotNull), - params: argThat(isNotNull), - paramName: argThat(isNotNull), - idParamName: argThat(isNotNull), - headers: argThat(isNotNull), - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.createDeployment( - siteId: '', - code: InputFile.fromPath(path: './image.png'), - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4,}; - test('test method createDuplicateDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.createDuplicateDeployment( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - }); - test('test method createTemplateDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.createTemplateDeployment( - siteId: '', - repository: '', - owner: '', - rootDirectory: '', - type: enums.TemplateReferenceType.branch, - reference: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createVcsDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.createVcsDeployment( - siteId: '', - type: enums.VCSReferenceType.branch, - reference: '', - ); - expect(response, isA()); - }); - test('test method getDeployment()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.getDeployment( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - }); + final response = await sites.getLog( + siteId: '', + logId: '', + ); + expect(response, isA()); - test('test method deleteDeployment()', () async { - final data = ''; + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method deleteLog()', () async { - final response = await sites.deleteDeployment( - siteId: '', - deploymentId: '', - ); - }); + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method getDeploymentDownload()', () async { - final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await sites.deleteLog( + siteId: '', + logId: '', + ); + }); - final response = await sites.getDeploymentDownload( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - }); + test('test method listVariables()', () async { - test('test method updateDeploymentStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': - 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.updateDeploymentStatus( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'variables': [],}; - test('test method listLogs()', () async { - final Map data = { - 'total': 5, - 'executions': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await sites.listLogs( - siteId: '', - ); - expect(response, isA()); - }); - test('test method getLog()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.getLog( - siteId: '', - logId: '', - ); - expect(response, isA()); - }); + final response = await sites.listVariables( + siteId: '', + ); + expect(response, isA()); - test('test method deleteLog()', () async { - final data = ''; + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method createVariable()', () async { - final response = await sites.deleteLog( - siteId: '', - logId: '', - ); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; - test('test method listVariables()', () async { - final Map data = { - 'total': 5, - 'variables': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await sites.listVariables( - siteId: '', - ); - expect(response, isA()); - }); - test('test method createVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.createVariable( - siteId: '', - key: '', - value: '', - ); - expect(response, isA()); - }); + final response = await sites.createVariable( + siteId: '', + variableId: '', + key: '', + value: '', + ); + expect(response, isA()); - test('test method getVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.getVariable( - siteId: '', - variableId: '', - ); - expect(response, isA()); - }); + }); - test('test method updateVariable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await sites.updateVariable( - siteId: '', - variableId: '', - key: '', - ); - expect(response, isA()); - }); + test('test method getVariable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.getVariable( + siteId: '', + variableId: '', + ); + expect(response, isA()); + + }); + + test('test method updateVariable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await sites.updateVariable( + siteId: '', + variableId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteVariable()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteVariable()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await sites.deleteVariable( + siteId: '', + variableId: '', + ); + }); - final response = await sites.deleteVariable( - siteId: '', - variableId: '', - ); }); - }); } diff --git a/test/services/storage_test.dart b/test/services/storage_test.dart index b6f8b202..fc585135 100644 --- a/test/services/storage_test.dart +++ b/test/services/storage_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,293 +36,323 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Storage test', () { - late MockClient client; - late Storage storage; + group('Storage test', () { + late MockClient client; + late Storage storage; + + setUp(() { + client = MockClient(); + storage = Storage(client); + }); + + test('test method listBuckets()', () async { + + final Map data = { + 'total': 5, + 'buckets': [],}; - setUp(() { - client = MockClient(); - storage = Storage(client); - }); - test('test method listBuckets()', () async { - final Map data = { - 'total': 5, - 'buckets': [], - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.listBuckets( + ); + expect(response, isA()); + + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createBucket()', () async { - final response = await storage.listBuckets(); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128,}; - test('test method createBucket()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await storage.createBucket( - bucketId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method getBucket()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await storage.getBucket( - bucketId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateBucket()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128, - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await storage.updateBucket( - bucketId: '', - name: '', - ); - expect(response, isA()); - }); - test('test method deleteBucket()', () async { - final data = ''; + final response = await storage.createBucket( + bucketId: '', + name: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await storage.deleteBucket( - bucketId: '', - ); - }); + test('test method getBucket()', () async { - test('test method listFiles()', () async { - final Map data = { - 'total': 5, - 'files': [], - }; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128,}; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await storage.listFiles( - bucketId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createFile()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip', - }; - - when(client.chunkedUpload( - path: argThat(isNotNull), - params: argThat(isNotNull), - paramName: argThat(isNotNull), - idParamName: argThat(isNotNull), - headers: argThat(isNotNull), - )).thenAnswer((_) async => Response(data: data)); - - final response = await storage.createFile( - bucketId: '', - fileId: '', - file: InputFile.fromPath(path: './image.png'), - ); - expect(response, isA()); - }); - test('test method getFile()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await storage.getFile( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - }); + final response = await storage.getBucket( + bucketId: '', + ); + expect(response, isA()); - test('test method updateFile()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await storage.updateFile( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - }); + }); - test('test method deleteFile()', () async { - final data = ''; + test('test method updateBucket()', () async { - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128,}; - final response = await storage.deleteFile( - bucketId: '', - fileId: '', - ); - }); - test('test method getFileDownload()', () async { - final Uint8List data = Uint8List.fromList([]); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await storage.getFileDownload( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - }); + final response = await storage.updateBucket( + bucketId: '', + name: '', + ); + expect(response, isA()); - test('test method getFilePreview()', () async { - final Uint8List data = Uint8List.fromList([]); + }); + + test('test method deleteBucket()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.deleteBucket( + bucketId: '', + ); + }); + + test('test method listFiles()', () async { + + final Map data = { + 'total': 5, + 'files': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.listFiles( + bucketId: '', + ); + expect(response, isA()); + + }); + + test('test method createFile()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip',}; + + + when(client.chunkedUpload( + path: argThat(isNotNull), + params: argThat(isNotNull), + paramName: argThat(isNotNull), + idParamName: argThat(isNotNull), + headers: argThat(isNotNull), + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.createFile( + bucketId: '', + fileId: '', + file: InputFile.fromPath(path: './image.png'), + ); + expect(response, isA()); + + }); + + test('test method getFile()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.getFile( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + + }); + + test('test method updateFile()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.updateFile( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteFile()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.deleteFile( + bucketId: '', + fileId: '', + ); + }); + + test('test method getFileDownload()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.getFileDownload( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + + }); + + test('test method getFilePreview()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await storage.getFilePreview( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + + }); + + test('test method getFileView()', () async {final Uint8List data = Uint8List.fromList([]); + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await storage.getFilePreview( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - }); - test('test method getFileView()', () async { - final Uint8List data = Uint8List.fromList([]); + final response = await storage.getFileView( + bucketId: '', + fileId: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await storage.getFileView( - bucketId: '', - fileId: '', - ); - expect(response, isA()); }); - }); } diff --git a/test/services/tables_db_test.dart b/test/services/tables_db_test.dart index c434c3b4..dbfd3962 100644 --- a/test/services/tables_db_test.dart +++ b/test/services/tables_db_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,1569 +36,1826 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('TablesDB test', () { - late MockClient client; - late TablesDB tablesDB; + group('TablesDB test', () { + late MockClient client; + late TablesDB tablesDB; - setUp(() { - client = MockClient(); - tablesDB = TablesDB(client); - }); + setUp(() { + client = MockClient(); + tablesDB = TablesDB(client); + }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'databases': [], - }; + test('test method list()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'databases': [],}; - final response = await tablesDB.list(); - expect(response, isA()); - }); - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.create( - databaseId: '', - name: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listTransactions()', () async { - final Map data = { - 'total': 5, - 'transactions': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await tablesDB.list( + ); + expect(response, isA()); - final response = await tablesDB.listTransactions(); - expect(response, isA()); - }); + }); - test('test method createTransaction()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createTransaction(); - expect(response, isA()); - }); + test('test method create()', () async { - test('test method getTransaction()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.getTransaction( - transactionId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; - test('test method updateTransaction()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateTransaction( - transactionId: '', - ); - expect(response, isA()); - }); - test('test method deleteTransaction()', () async { - final data = ''; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.deleteTransaction( - transactionId: '', - ); - }); + final response = await tablesDB.create( + databaseId: '', + name: '', + ); + expect(response, isA()); - test('test method createOperations()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createOperations( - transactionId: '', - ); - expect(response, isA()); - }); + }); - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.get( - databaseId: '', - ); - expect(response, isA()); - }); + test('test method listTransactions()', () async { - test('test method update()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.update( - databaseId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'transactions': [],}; - test('test method delete()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.delete( - databaseId: '', - ); - }); - test('test method listTables()', () async { - final Map data = { - 'total': 5, - 'tables': [], - }; + final response = await tablesDB.listTransactions( + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await tablesDB.listTables( - databaseId: '', - ); - expect(response, isA()); - }); + test('test method createTransaction()', () async { - test('test method createTable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createTable( - databaseId: '', - tableId: '', - name: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method getTable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.getTable( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); - test('test method updateTable()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500, - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateTable( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteTable()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await tablesDB.createTransaction( + ); + expect(response, isA()); - final response = await tablesDB.deleteTable( - databaseId: '', - tableId: '', - ); - }); + }); - test('test method listColumns()', () async { - final Map data = { - 'total': 5, - 'columns': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.listColumns( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); + test('test method getTransaction()', () async { - test('test method createBooleanColumn()', () async { - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createBooleanColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method updateBooleanColumn()', () async { - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateBooleanColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: true, - ); - expect(response, isA()); - }); - test('test method createDatetimeColumn()', () async { - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createDatetimeColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateDatetimeColumn()', () async { - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateDatetimeColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '2020-10-15T06:38:00.000+00:00', - ); - expect(response, isA()); - }); - test('test method createEmailColumn()', () async { - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createEmailColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final response = await tablesDB.getTransaction( + transactionId: '', + ); + expect(response, isA()); - test('test method updateEmailColumn()', () async { - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateEmailColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 'email@example.com', - ); - expect(response, isA()); - }); + }); - test('test method createEnumColumn()', () async { - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createEnumColumn( - databaseId: '', - tableId: '', - key: '', - elements: [], - xrequired: true, - ); - expect(response, isA()); - }); + test('test method updateTransaction()', () async { - test('test method updateEnumColumn()', () async { - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateEnumColumn( - databaseId: '', - tableId: '', - key: '', - elements: [], - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method createFloatColumn()', () async { - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createFloatColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateFloatColumn()', () async { - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateFloatColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 1.0, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method createIntegerColumn()', () async { - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createIntegerColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateIntegerColumn()', () async { - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateIntegerColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 1, - ); - expect(response, isA()); - }); + final response = await tablesDB.updateTransaction( + transactionId: '', + ); + expect(response, isA()); - test('test method createIpColumn()', () async { - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createIpColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + }); - test('test method updateIpColumn()', () async { - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateIpColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + test('test method deleteTransaction()', () async { - test('test method createLineColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createLineColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final data = ''; - test('test method updateLineColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateLineColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method createLongtextColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createLongtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateLongtextColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateLongtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final response = await tablesDB.deleteTransaction( + transactionId: '', + ); + }); - test('test method createMediumtextColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createMediumtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + test('test method createOperations()', () async { - test('test method updateMediumtextColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateMediumtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method createPointColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createPointColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updatePointColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updatePointColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - test('test method createPolygonColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createPolygonColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updatePolygonColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updatePolygonColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); + final response = await tablesDB.createOperations( + transactionId: '', + ); + expect(response, isA()); - test('test method createRelationshipColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createRelationshipColumn( - databaseId: '', - tableId: '', - relatedTableId: '', - type: enums.RelationshipType.oneToOne, - ); - expect(response, isA()); - }); + }); - test('test method createStringColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createStringColumn( - databaseId: '', - tableId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - }); + test('test method get()', () async { - test('test method updateStringColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateStringColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; - test('test method createTextColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createTextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateTextColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateTextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createUrlColumn()', () async { - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createUrlColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - }); - test('test method updateUrlColumn()', () async { - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateUrlColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 'https://example.com', - ); - expect(response, isA()); - }); + final response = await tablesDB.get( + databaseId: '', + ); + expect(response, isA()); - test('test method createVarcharColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createVarcharColumn( - databaseId: '', - tableId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - }); + }); - test('test method updateVarcharColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateVarcharColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - }); + test('test method update()', () async { - test('test method getColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.getColumn( - databaseId: '', - tableId: '', - key: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; - test('test method deleteColumn()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.deleteColumn( - databaseId: '', - tableId: '', - key: '', - ); - }); - test('test method updateRelationshipColumn()', () async { - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateRelationshipColumn( - databaseId: '', - tableId: '', - key: '', - ); - expect(response, isA()); - }); + final response = await tablesDB.update( + databaseId: '', + ); + expect(response, isA()); - test('test method listIndexes()', () async { - final Map data = { - 'total': 5, - 'indexes': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.listIndexes( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); + }); - test('test method createIndex()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createIndex( - databaseId: '', - tableId: '', - key: '', - type: enums.TablesDBIndexType.key, - columns: [], - ); - expect(response, isA()); - }); + test('test method delete()', () async { - test('test method getIndex()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.getIndex( - databaseId: '', - tableId: '', - key: '', - ); - expect(response, isA()); - }); + final data = ''; - test('test method deleteIndex()', () async { - final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.deleteIndex( - databaseId: '', - tableId: '', - key: '', - ); - }); + final response = await tablesDB.delete( + databaseId: '', + ); + }); - test('test method listRows()', () async { - final Map data = { - 'total': 5, - 'rows': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.listRows( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); + test('test method listTables()', () async { - test('test method createRow()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createRow( - databaseId: '', - tableId: '', - rowId: '', - data: {}, - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'tables': [],}; - test('test method createRows()', () async { - final Map data = { - 'total': 5, - 'rows': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.createRows( - databaseId: '', - tableId: '', - rows: [], - ); - expect(response, isA()); - }); - test('test method upsertRows()', () async { - final Map data = { - 'total': 5, - 'rows': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.upsertRows( - databaseId: '', - tableId: '', - rows: [], - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateRows()', () async { - final Map data = { - 'total': 5, - 'rows': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateRows( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); - test('test method deleteRows()', () async { - final Map data = { - 'total': 5, - 'rows': [], - }; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.deleteRows( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - }); + final response = await tablesDB.listTables( + databaseId: '', + ); + expect(response, isA()); - test('test method getRow()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.getRow( - databaseId: '', - tableId: '', - rowId: '', - ); - expect(response, isA()); - }); + }); - test('test method upsertRow()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.upsertRow( - databaseId: '', - tableId: '', - rowId: '', - ); - expect(response, isA()); - }); + test('test method createTable()', () async { - test('test method updateRow()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.updateRow( - databaseId: '', - tableId: '', - rowId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; - test('test method deleteRow()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.deleteRow( - databaseId: '', - tableId: '', - rowId: '', - ); - }); - test('test method decrementRowColumn()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.decrementRowColumn( - databaseId: '', - tableId: '', - rowId: '', - column: '', - ); - expect(response, isA()); - }); + final response = await tablesDB.createTable( + databaseId: '', + tableId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method getTable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.getTable( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method updateTable()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateTable( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteTable()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.deleteTable( + databaseId: '', + tableId: '', + ); + }); + + test('test method listColumns()', () async { + + final Map data = { + 'total': 5, + 'columns': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.listColumns( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method createBigIntColumn()', () async { + + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateBigIntColumn()', () async { + + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + + }); + + test('test method createBooleanColumn()', () async { + + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createBooleanColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateBooleanColumn()', () async { + + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateBooleanColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: true, + ); + expect(response, isA()); + + }); + + test('test method createDatetimeColumn()', () async { + + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateDatetimeColumn()', () async { + + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '2020-10-15T06:38:00.000+00:00', + ); + expect(response, isA()); + + }); + + test('test method createEmailColumn()', () async { + + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createEmailColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateEmailColumn()', () async { + + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateEmailColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 'email@example.com', + ); + expect(response, isA()); + + }); + + test('test method createEnumColumn()', () async { + + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateEnumColumn()', () async { + + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createFloatColumn()', () async { + + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createFloatColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateFloatColumn()', () async { + + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateFloatColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1.0, + ); + expect(response, isA()); + + }); + + test('test method createIntegerColumn()', () async { + + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createIntegerColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateIntegerColumn()', () async { + + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateIntegerColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + + }); + + test('test method createIpColumn()', () async { + + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createIpColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateIpColumn()', () async { + + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateIpColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createLineColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createLineColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateLineColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateLineColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method createLongtextColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createLongtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateLongtextColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateLongtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createMediumtextColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateMediumtextColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createPointColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createPointColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updatePointColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updatePointColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method createPolygonColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createPolygonColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updatePolygonColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updatePolygonColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method createRelationshipColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedTable': 'table', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createRelationshipColumn( + databaseId: '', + tableId: '', + relatedTableId: '', + type: enums.RelationshipType.oneToOne, + ); + expect(response, isA()); + + }); + + test('test method createStringColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createStringColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateStringColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateStringColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createTextColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createTextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateTextColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateTextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method createUrlColumn()', () async { + + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createUrlColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateUrlColumn()', () async { + + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateUrlColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 'https://example.com', + ); + expect(response, isA()); + + }); + + test('test method createVarcharColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createVarcharColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + + }); + + test('test method updateVarcharColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateVarcharColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + + }); + + test('test method getColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.getColumn( + databaseId: '', + tableId: '', + key: '', + ); + expect(response, isA()); + + }); + + test('test method deleteColumn()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.deleteColumn( + databaseId: '', + tableId: '', + key: '', + ); + }); + + test('test method updateRelationshipColumn()', () async { + + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedTable': 'table', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateRelationshipColumn( + databaseId: '', + tableId: '', + key: '', + ); + expect(response, isA()); + + }); + + test('test method listIndexes()', () async { + + final Map data = { + 'total': 5, + 'indexes': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.listIndexes( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method createIndex()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'columns': [], + 'lengths': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createIndex( + databaseId: '', + tableId: '', + key: '', + type: enums.TablesDBIndexType.key, + columns: [], + ); + expect(response, isA()); + + }); + + test('test method getIndex()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'columns': [], + 'lengths': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.getIndex( + databaseId: '', + tableId: '', + key: '', + ); + expect(response, isA()); + + }); + + test('test method deleteIndex()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.deleteIndex( + databaseId: '', + tableId: '', + key: '', + ); + }); + + test('test method listRows()', () async { + + final Map data = { + 'total': 5, + 'rows': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.listRows( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method createRow()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createRow( + databaseId: '', + tableId: '', + rowId: '', + data: {}, + ); + expect(response, isA()); + + }); + + test('test method createRows()', () async { + + final Map data = { + 'total': 5, + 'rows': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.createRows( + databaseId: '', + tableId: '', + rows: [], + ); + expect(response, isA()); + + }); + + test('test method upsertRows()', () async { + + final Map data = { + 'total': 5, + 'rows': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.upsertRows( + databaseId: '', + tableId: '', + rows: [], + ); + expect(response, isA()); + + }); + + test('test method updateRows()', () async { + + final Map data = { + 'total': 5, + 'rows': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateRows( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteRows()', () async { + + final Map data = { + 'total': 5, + 'rows': [],}; + + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.deleteRows( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + + }); + + test('test method getRow()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.getRow( + databaseId: '', + tableId: '', + rowId: '', + ); + expect(response, isA()); + + }); + + test('test method upsertRow()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.upsertRow( + databaseId: '', + tableId: '', + rowId: '', + ); + expect(response, isA()); + + }); + + test('test method updateRow()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.updateRow( + databaseId: '', + tableId: '', + rowId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteRow()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.deleteRow( + databaseId: '', + tableId: '', + rowId: '', + ); + }); + + test('test method decrementRowColumn()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.decrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + ); + expect(response, isA()); + + }); + + test('test method incrementRowColumn()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tablesDB.incrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + ); + expect(response, isA()); + + }); - test('test method incrementRowColumn()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tablesDB.incrementRowColumn( - databaseId: '', - tableId: '', - rowId: '', - column: '', - ); - expect(response, isA()); }); - }); } diff --git a/test/services/teams_test.dart b/test/services/teams_test.dart index b955fd52..38db809f 100644 --- a/test/services/teams_test.dart +++ b/test/services/teams_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,280 +36,322 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Teams test', () { - late MockClient client; - late Teams teams; + group('Teams test', () { + late MockClient client; + late Teams teams; - setUp(() { - client = MockClient(); - teams = Teams(client); - }); + setUp(() { + client = MockClient(); + teams = Teams(client); + }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'teams': [], - }; + test('test method list()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'teams': [],}; - final response = await teams.list(); - expect(response, isA()); - }); - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {}, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.create( - teamId: '', - name: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {}, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.get( - teamId: '', - ); - expect(response, isA()); - }); - test('test method updateName()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {}, - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.updateName( - teamId: '', - name: '', - ); - expect(response, isA()); - }); + final response = await teams.list( + ); + expect(response, isA()); - test('test method delete()', () async { - final data = ''; + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method create()', () async { - final response = await teams.delete( - teamId: '', - ); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {},}; - test('test method listMemberships()', () async { - final Map data = { - 'total': 5, - 'memberships': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await teams.listMemberships( - teamId: '', - ); - expect(response, isA()); - }); - test('test method createMembership()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [], - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.createMembership( - teamId: '', - roles: [], - ); - expect(response, isA()); - }); + final response = await teams.create( + teamId: '', + name: '', + ); + expect(response, isA()); - test('test method getMembership()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.getMembership( - teamId: '', - membershipId: '', - ); - expect(response, isA()); - }); + }); - test('test method updateMembership()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.updateMembership( - teamId: '', - membershipId: '', - roles: [], - ); - expect(response, isA()); - }); + test('test method get()', () async { - test('test method deleteMembership()', () async { - final data = ''; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {},}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await teams.deleteMembership( - teamId: '', - membershipId: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateMembershipStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [], - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await teams.updateMembershipStatus( - teamId: '', - membershipId: '', - userId: '', - secret: '', - ); - expect(response, isA()); - }); - test('test method getPrefs()', () async { - final Map data = {}; + final response = await teams.get( + teamId: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); + + test('test method updateName()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {},}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.updateName( + teamId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.delete( + teamId: '', + ); + }); + + test('test method listMemberships()', () async { + + final Map data = { + 'total': 5, + 'memberships': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.listMemberships( + teamId: '', + ); + expect(response, isA()); + + }); + + test('test method createMembership()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.createMembership( + teamId: '', + roles: [], + ); + expect(response, isA()); + + }); + + test('test method getMembership()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.getMembership( + teamId: '', + membershipId: '', + ); + expect(response, isA()); + + }); + + test('test method updateMembership()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.updateMembership( + teamId: '', + membershipId: '', + roles: [], + ); + expect(response, isA()); + + }); + + test('test method deleteMembership()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.deleteMembership( + teamId: '', + membershipId: '', + ); + }); + + test('test method updateMembershipStatus()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.updateMembershipStatus( + teamId: '', + membershipId: '', + userId: '', + secret: '', + ); + expect(response, isA()); + + }); + + test('test method getPrefs()', () async { + + final Map data = {}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await teams.getPrefs( + teamId: '', + ); + expect(response, isA()); + + }); + + test('test method updatePrefs()', () async { + + final Map data = {}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - final response = await teams.getPrefs( - teamId: '', - ); - expect(response, isA()); - }); - test('test method updatePrefs()', () async { - final Map data = {}; + final response = await teams.updatePrefs( + teamId: '', + prefs: {}, + ); + expect(response, isA()); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await teams.updatePrefs( - teamId: '', - prefs: {}, - ); - expect(response, isA()); }); - }); } diff --git a/test/services/tokens_test.dart b/test/services/tokens_test.dart index 152d7b8a..0e08fb4b 100644 --- a/test/services/tokens_test.dart +++ b/test/services/tokens_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,117 +36,126 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Tokens test', () { - late MockClient client; - late Tokens tokens; + group('Tokens test', () { + late MockClient client; + late Tokens tokens; - setUp(() { - client = MockClient(); - tokens = Tokens(client); - }); + setUp(() { + client = MockClient(); + tokens = Tokens(client); + }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'tokens': [], - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tokens.list( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - }); + test('test method list()', () async { - test('test method createFileToken()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tokens.createFileToken( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'total': 5, + 'tokens': [],}; - test('test method get()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tokens.get( - tokenId: '', - ); - expect(response, isA()); - }); - test('test method update()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await tokens.update( - tokenId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tokens.list( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + + }); + + test('test method createFileToken()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tokens.createFileToken( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + + }); + + test('test method get()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tokens.get( + tokenId: '', + ); + expect(response, isA()); + + }); + + test('test method update()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await tokens.update( + tokenId: '', + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method delete()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await tokens.delete( + tokenId: '', + ); + }); - final response = await tokens.delete( - tokenId: '', - ); }); - }); } diff --git a/test/services/users_test.dart b/test/services/users_test.dart index ee8e4e51..80b8102c 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,1137 +36,1278 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Users test', () { - late MockClient client; - late Users users; + group('Users test', () { + late MockClient client; + late Users users; + + setUp(() { + client = MockClient(); + users = Users(client); + }); + + test('test method list()', () async { + + final Map data = { + 'total': 5, + 'users': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.list( + ); + expect(response, isA()); + + }); + + test('test method create()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - setUp(() { - client = MockClient(); - users = Users(client); - }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'users': [], - }; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await users.list(); - expect(response, isA()); - }); + final response = await users.create( + userId: '', + ); + expect(response, isA()); - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.create( - userId: '', - ); - expect(response, isA()); - }); + }); - test('test method createArgon2User()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createArgon2User( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); + test('test method createArgon2User()', () async { - test('test method createBcryptUser()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createBcryptUser( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createArgon2User( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); - test('test method listIdentities()', () async { - final Map data = { - 'total': 5, - 'identities': [], - }; + test('test method createBcryptUser()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createBcryptUser( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method listIdentities()', () async { + + final Map data = { + 'total': 5, + 'identities': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.listIdentities( + ); + expect(response, isA()); + + }); + + test('test method deleteIdentity()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.deleteIdentity( + identityId: '', + ); + }); + + test('test method createMD5User()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createMD5User( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method createPHPassUser()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createPHPassUser( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method createScryptUser()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createScryptUser( + userId: '', + email: 'email@example.com', + password: 'password', + passwordSalt: '', + passwordCpu: 1, + passwordMemory: 1, + passwordParallel: 1, + passwordLength: 1, + ); + expect(response, isA()); + + }); + + test('test method createScryptModifiedUser()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createScryptModifiedUser( + userId: '', + email: 'email@example.com', + password: 'password', + passwordSalt: '', + passwordSaltSeparator: '', + passwordSignerKey: '', + ); + expect(response, isA()); + + }); + + test('test method createSHAUser()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createSHAUser( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + + }); + + test('test method get()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.get( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.delete( + userId: '', + ); + }); + + test('test method updateEmail()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateEmail( + userId: '', + email: 'email@example.com', + ); + expect(response, isA()); - final response = await users.listIdentities(); - expect(response, isA()); - }); + }); - test('test method deleteIdentity()', () async { - final data = ''; + test('test method updateImpersonator()', () async { - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - final response = await users.deleteIdentity( - identityId: '', - ); - }); - test('test method createMD5User()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createMD5User( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method createPHPassUser()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createPHPassUser( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); - test('test method createScryptUser()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createScryptUser( - userId: '', - email: 'email@example.com', - password: 'password', - passwordSalt: '', - passwordCpu: 1, - passwordMemory: 1, - passwordParallel: 1, - passwordLength: 1, - ); - expect(response, isA()); - }); + final response = await users.updateImpersonator( + userId: '', + impersonator: true, + ); + expect(response, isA()); - test('test method createScryptModifiedUser()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createScryptModifiedUser( - userId: '', - email: 'email@example.com', - password: 'password', - passwordSalt: '', - passwordSaltSeparator: '', - passwordSignerKey: '', - ); - expect(response, isA()); - }); + }); - test('test method createSHAUser()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createSHAUser( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - }); + test('test method createJWT()', () async { - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.get( - userId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - test('test method delete()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.delete( - userId: '', - ); - }); - test('test method updateEmail()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateEmail( - userId: '', - email: 'email@example.com', - ); - expect(response, isA()); - }); + final response = await users.createJWT( + userId: '', + ); + expect(response, isA()); - test('test method updateImpersonator()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateImpersonator( - userId: '', - impersonator: true, - ); - expect(response, isA()); - }); + }); - test('test method createJWT()', () async { - final Map data = { - 'jwt': - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - }; + test('test method updateLabels()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - final response = await users.createJWT( - userId: '', - ); - expect(response, isA()); - }); + final response = await users.updateLabels( + userId: '', + labels: [], + ); + expect(response, isA()); - test('test method updateLabels()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateLabels( - userId: '', - labels: [], - ); - expect(response, isA()); - }); + }); - test('test method listLogs()', () async { - final Map data = { - 'total': 5, - 'logs': [], - }; + test('test method listLogs()', () async { - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final Map data = { + 'total': 5, + 'logs': [],}; - final response = await users.listLogs( - userId: '', - ); - expect(response, isA()); - }); - test('test method listMemberships()', () async { - final Map data = { - 'total': 5, - 'memberships': [], - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - final response = await users.listMemberships( - userId: '', - ); - expect(response, isA()); - }); + final response = await users.listLogs( + userId: '', + ); + expect(response, isA()); - test('test method updateMfa()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateMfa( - userId: '', - mfa: true, - ); - expect(response, isA()); - }); + }); - test('test method updateMFA()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateMFA( - userId: '', - mfa: true, - ); - expect(response, isA()); - }); + test('test method listMemberships()', () async { - test('test method deleteMfaAuthenticator()', () async { - final data = ''; + final Map data = { + 'total': 5, + 'memberships': [],}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await users.deleteMfaAuthenticator( - userId: '', - type: enums.AuthenticatorType.totp, - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteMFAAuthenticator()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await users.listMemberships( + userId: '', + ); + expect(response, isA()); - final response = await users.deleteMFAAuthenticator( - userId: '', - type: enums.AuthenticatorType.totp, - ); - }); + }); - test('test method listMfaFactors()', () async { - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.listMfaFactors( - userId: '', - ); - expect(response, isA()); - }); + test('test method updateMfa()', () async { - test('test method listMFAFactors()', () async { - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.listMFAFactors( - userId: '', - ); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - test('test method getMfaRecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.getMfaRecoveryCodes( - userId: '', - ); - expect(response, isA()); - }); - test('test method getMFARecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + final response = await users.updateMfa( + userId: '', + mfa: true, + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await users.getMFARecoveryCodes( - userId: '', - ); - expect(response, isA()); - }); + test('test method updateMFA()', () async { - test('test method updateMfaRecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - final response = await users.updateMfaRecoveryCodes( - userId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateMFARecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + final response = await users.updateMFA( + userId: '', + mfa: true, + ); + expect(response, isA()); - final response = await users.updateMFARecoveryCodes( - userId: '', - ); - expect(response, isA()); - }); + }); - test('test method createMfaRecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; + test('test method deleteMfaAuthenticator()', () async { - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + final data = ''; - final response = await users.createMfaRecoveryCodes( - userId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method createMFARecoveryCodes()', () async { - final Map data = { - 'recoveryCodes': [], - }; - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + final response = await users.deleteMfaAuthenticator( + userId: '', + type: enums.AuthenticatorType.totp, + ); + }); - final response = await users.createMFARecoveryCodes( - userId: '', - ); - expect(response, isA()); - }); + test('test method deleteMFAAuthenticator()', () async { - test('test method updateName()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateName( - userId: '', - name: '', - ); - expect(response, isA()); - }); + final data = ''; - test('test method updatePassword()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updatePassword( - userId: '', - password: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method updatePhone()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updatePhone( - userId: '', - number: '+12065550100', - ); - expect(response, isA()); - }); - test('test method getPrefs()', () async { - final Map data = {}; + final response = await users.deleteMFAAuthenticator( + userId: '', + type: enums.AuthenticatorType.totp, + ); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listMfaFactors()', () async { - final response = await users.getPrefs( - userId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; - test('test method updatePrefs()', () async { - final Map data = {}; - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.updatePrefs( - userId: '', - prefs: {}, - ); - expect(response, isA()); - }); - test('test method listSessions()', () async { - final Map data = { - 'total': 5, - 'sessions': [], - }; + final response = await users.listMfaFactors( + userId: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await users.listSessions( - userId: '', - ); - expect(response, isA()); - }); + test('test method listMFAFactors()', () async { - test('test method createSession()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createSession( - userId: '', - ); - expect(response, isA()); - }); + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; - test('test method deleteSessions()', () async { - final data = ''; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.deleteSessions( - userId: '', - ); - }); - test('test method deleteSession()', () async { - final data = ''; + final response = await users.listMFAFactors( + userId: '', + ); + expect(response, isA()); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + }); - final response = await users.deleteSession( - userId: '', - sessionId: '', - ); - }); + test('test method getMfaRecoveryCodes()', () async { - test('test method updateStatus()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateStatus( - userId: '', - status: true, - ); - expect(response, isA()); - }); + final Map data = { + 'recoveryCodes': [],}; - test('test method listTargets()', () async { - final Map data = { - 'total': 5, - 'targets': [], - }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.listTargets( - userId: '', - ); - expect(response, isA()); - }); - test('test method createTarget()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createTarget( - userId: '', - targetId: '', - providerType: enums.MessagingProviderType.email, - identifier: '', - ); - expect(response, isA()); - }); + final response = await users.getMfaRecoveryCodes( + userId: '', + ); + expect(response, isA()); - test('test method getTarget()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.getTarget( - userId: '', - targetId: '', - ); - expect(response, isA()); - }); + }); - test('test method updateTarget()', () async { - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateTarget( - userId: '', - targetId: '', - ); - expect(response, isA()); - }); + test('test method getMFARecoveryCodes()', () async { - test('test method deleteTarget()', () async { - final data = ''; + final Map data = { + 'recoveryCodes': [],}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await users.deleteTarget( - userId: '', - targetId: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createToken()', () async { - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox', - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.createToken( - userId: '', - ); - expect(response, isA()); - }); - test('test method updateEmailVerification()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updateEmailVerification( - userId: '', - emailVerification: true, - ); - expect(response, isA()); - }); + final response = await users.getMFARecoveryCodes( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method updateMfaRecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateMfaRecoveryCodes( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method updateMFARecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateMFARecoveryCodes( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method createMfaRecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createMfaRecoveryCodes( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method createMFARecoveryCodes()', () async { + + final Map data = { + 'recoveryCodes': [],}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createMFARecoveryCodes( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method updateName()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateName( + userId: '', + name: '', + ); + expect(response, isA()); + + }); + + test('test method updatePassword()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updatePassword( + userId: '', + password: '', + ); + expect(response, isA()); + + }); + + test('test method updatePhone()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updatePhone( + userId: '', + number: '+12065550100', + ); + expect(response, isA()); + + }); + + test('test method getPrefs()', () async { + + final Map data = {}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.getPrefs( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method updatePrefs()', () async { + + final Map data = {}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updatePrefs( + userId: '', + prefs: {}, + ); + expect(response, isA()); + + }); + + test('test method listSessions()', () async { + + final Map data = { + 'total': 5, + 'sessions': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.listSessions( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method createSession()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createSession( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteSessions()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.deleteSessions( + userId: '', + ); + }); + + test('test method deleteSession()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.deleteSession( + userId: '', + sessionId: '', + ); + }); + + test('test method updateStatus()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateStatus( + userId: '', + status: true, + ); + expect(response, isA()); + + }); + + test('test method listTargets()', () async { + + final Map data = { + 'total': 5, + 'targets': [],}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.listTargets( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method createTarget()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true,}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createTarget( + userId: '', + targetId: '', + providerType: enums.MessagingProviderType.email, + identifier: '', + ); + expect(response, isA()); + + }); + + test('test method getTarget()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true,}; + + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.getTarget( + userId: '', + targetId: '', + ); + expect(response, isA()); + + }); + + test('test method updateTarget()', () async { + + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateTarget( + userId: '', + targetId: '', + ); + expect(response, isA()); + + }); + + test('test method deleteTarget()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.deleteTarget( + userId: '', + targetId: '', + ); + }); + + test('test method createToken()', () async { + + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.createToken( + userId: '', + ); + expect(response, isA()); + + }); + + test('test method updateEmailVerification()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updateEmailVerification( + userId: '', + emailVerification: true, + ); + expect(response, isA()); + + }); + + test('test method updatePhoneVerification()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await users.updatePhoneVerification( + userId: '', + phoneVerification: true, + ); + expect(response, isA()); + + }); - test('test method updatePhoneVerification()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await users.updatePhoneVerification( - userId: '', - phoneVerification: true, - ); - expect(response, isA()); }); - }); } diff --git a/test/services/webhooks_test.dart b/test/services/webhooks_test.dart index 58a633e0..0184851b 100644 --- a/test/services/webhooks_test.dart +++ b/test/services/webhooks_test.dart @@ -24,8 +24,7 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super - .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -37,161 +36,177 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod( - Invocation.method( - #chunkedUpload, [path, params, paramName, idParamName, headers]), - returnValue: Response(data: {})); + return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); } } void main() { - group('Webhooks test', () { - late MockClient client; - late Webhooks webhooks; + group('Webhooks test', () { + late MockClient client; + late Webhooks webhooks; + + setUp(() { + client = MockClient(); + webhooks = Webhooks(client); + }); + + test('test method list()', () async { + + final Map data = { + 'total': 5, + 'webhooks': [],}; - setUp(() { - client = MockClient(); - webhooks = Webhooks(client); - }); - test('test method list()', () async { - final Map data = { - 'total': 5, - 'webhooks': [], - }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await webhooks.list( + ); + expect(response, isA()); + + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method create()', () async { - final response = await webhooks.list(); - expect(response, isA()); - }); + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; - test('test method create()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10, - }; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - final response = await webhooks.create( - webhookId: '', - url: '', - name: '', - events: [], - ); - expect(response, isA()); - }); - test('test method get()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10, - }; - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - final response = await webhooks.get( - webhookId: '', - ); - expect(response, isA()); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await webhooks.create( + webhookId: '', + url: '', + name: '', + events: [], + ); + expect(response, isA()); + + }); - test('test method update()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10, - }; - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - final response = await webhooks.update( - webhookId: '', - name: '', - url: '', - events: [], - ); - expect(response, isA()); - }); + test('test method get()', () async { - test('test method delete()', () async { - final data = ''; + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - final response = await webhooks.delete( - webhookId: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await webhooks.get( + webhookId: '', + ); + expect(response, isA()); + + }); + + test('test method update()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; + + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await webhooks.update( + webhookId: '', + name: '', + url: '', + events: [], + ); + expect(response, isA()); + + }); + + test('test method delete()', () async { + + final data = ''; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await webhooks.delete( + webhookId: '', + ); + }); + + test('test method updateSecret()', () async { + + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; + + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + + final response = await webhooks.updateSecret( + webhookId: '', + ); + expect(response, isA()); + + }); - test('test method updateSecret()', () async { - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10, - }; - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - final response = await webhooks.updateSecret( - webhookId: '', - ); - expect(response, isA()); }); - }); } diff --git a/test/src/models/activity_event_list_test.dart b/test/src/models/activity_event_list_test.dart index fa2c4646..dea30a98 100644 --- a/test/src/models/activity_event_list_test.dart +++ b/test/src/models/activity_event_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ActivityEventList.fromMap(map); - expect(result.total, 5); - expect(result.events, []); - }); + expect(result.total, 5); + expect(result.events, []); + }); }); } diff --git a/test/src/models/activity_event_test.dart b/test/src/models/activity_event_test.dart index 3db2598a..81ef69f5 100644 --- a/test/src/models/activity_event_test.dart +++ b/test/src/models/activity_event_test.dart @@ -15,8 +15,7 @@ void main() { resourceId: '610fc2f985ee0', resource: 'collections/610fc2f985ee0', event: 'account.sessions.create', - userAgent: - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', ip: '127.0.0.1', mode: 'admin', country: 'US', @@ -43,39 +42,38 @@ void main() { final map = model.toMap(); final result = ActivityEvent.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.userType, 'user'); - expect(result.userId, '610fc2f985ee0'); - expect(result.userEmail, 'john@appwrite.io'); - expect(result.userName, 'John Doe'); - expect(result.resourceParent, 'database/ID'); - expect(result.resourceType, 'collection'); - expect(result.resourceId, '610fc2f985ee0'); - expect(result.resource, 'collections/610fc2f985ee0'); - expect(result.event, 'account.sessions.create'); - expect(result.userAgent, - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); - expect(result.ip, '127.0.0.1'); - expect(result.mode, 'admin'); - expect(result.country, 'US'); - expect(result.time, '2020-10-15T06:38:00.000+00:00'); - expect(result.projectId, '610fc2f985ee0'); - expect(result.teamId, '610fc2f985ee0'); - expect(result.hostname, 'appwrite.io'); - expect(result.osCode, 'Mac'); - expect(result.osName, 'Mac'); - expect(result.osVersion, 'Mac'); - expect(result.clientType, 'browser'); - expect(result.clientCode, 'CM'); - expect(result.clientName, 'Chrome Mobile iOS'); - expect(result.clientVersion, '84.0'); - expect(result.clientEngine, 'WebKit'); - expect(result.clientEngineVersion, '605.1.15'); - expect(result.deviceName, 'smartphone'); - expect(result.deviceBrand, 'Google'); - expect(result.deviceModel, 'Nexus 5'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.userType, 'user'); + expect(result.userId, '610fc2f985ee0'); + expect(result.userEmail, 'john@appwrite.io'); + expect(result.userName, 'John Doe'); + expect(result.resourceParent, 'database/ID'); + expect(result.resourceType, 'collection'); + expect(result.resourceId, '610fc2f985ee0'); + expect(result.resource, 'collections/610fc2f985ee0'); + expect(result.event, 'account.sessions.create'); + expect(result.userAgent, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); + expect(result.ip, '127.0.0.1'); + expect(result.mode, 'admin'); + expect(result.country, 'US'); + expect(result.time, '2020-10-15T06:38:00.000+00:00'); + expect(result.projectId, '610fc2f985ee0'); + expect(result.teamId, '610fc2f985ee0'); + expect(result.hostname, 'appwrite.io'); + expect(result.osCode, 'Mac'); + expect(result.osName, 'Mac'); + expect(result.osVersion, 'Mac'); + expect(result.clientType, 'browser'); + expect(result.clientCode, 'CM'); + expect(result.clientName, 'Chrome Mobile iOS'); + expect(result.clientVersion, '84.0'); + expect(result.clientEngine, 'WebKit'); + expect(result.clientEngineVersion, '605.1.15'); + expect(result.deviceName, 'smartphone'); + expect(result.deviceBrand, 'Google'); + expect(result.deviceModel, 'Nexus 5'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + }); }); } diff --git a/test/src/models/algo_argon2_test.dart b/test/src/models/algo_argon2_test.dart index d55be87a..8e579a4a 100644 --- a/test/src/models/algo_argon2_test.dart +++ b/test/src/models/algo_argon2_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = AlgoArgon2.fromMap(map); - expect(result.type, 'argon2'); - expect(result.memoryCost, 65536); - expect(result.timeCost, 4); - expect(result.threads, 3); - }); + expect(result.type, 'argon2'); + expect(result.memoryCost, 65536); + expect(result.timeCost, 4); + expect(result.threads, 3); + }); }); } diff --git a/test/src/models/algo_bcrypt_test.dart b/test/src/models/algo_bcrypt_test.dart index 3046b077..9d9117ac 100644 --- a/test/src/models/algo_bcrypt_test.dart +++ b/test/src/models/algo_bcrypt_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoBcrypt.fromMap(map); - expect(result.type, 'bcrypt'); - }); + expect(result.type, 'bcrypt'); + }); }); } diff --git a/test/src/models/algo_md5_test.dart b/test/src/models/algo_md5_test.dart index 01bb0836..a8074312 100644 --- a/test/src/models/algo_md5_test.dart +++ b/test/src/models/algo_md5_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoMd5.fromMap(map); - expect(result.type, 'md5'); - }); + expect(result.type, 'md5'); + }); }); } diff --git a/test/src/models/algo_phpass_test.dart b/test/src/models/algo_phpass_test.dart index 50c43860..414d5658 100644 --- a/test/src/models/algo_phpass_test.dart +++ b/test/src/models/algo_phpass_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoPhpass.fromMap(map); - expect(result.type, 'phpass'); - }); + expect(result.type, 'phpass'); + }); }); } diff --git a/test/src/models/algo_scrypt_modified_test.dart b/test/src/models/algo_scrypt_modified_test.dart index 4d1dda53..53596100 100644 --- a/test/src/models/algo_scrypt_modified_test.dart +++ b/test/src/models/algo_scrypt_modified_test.dart @@ -8,18 +8,16 @@ void main() { type: 'scryptMod', salt: 'UxLMreBr6tYyjQ==', saltSeparator: 'Bw==', - signerKey: - 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ==', + signerKey: 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ==', ); final map = model.toMap(); final result = AlgoScryptModified.fromMap(map); - expect(result.type, 'scryptMod'); - expect(result.salt, 'UxLMreBr6tYyjQ=='); - expect(result.saltSeparator, 'Bw=='); - expect(result.signerKey, - 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ=='); - }); + expect(result.type, 'scryptMod'); + expect(result.salt, 'UxLMreBr6tYyjQ=='); + expect(result.saltSeparator, 'Bw=='); + expect(result.signerKey, 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ=='); + }); }); } diff --git a/test/src/models/algo_scrypt_test.dart b/test/src/models/algo_scrypt_test.dart index aa3128c5..ead39885 100644 --- a/test/src/models/algo_scrypt_test.dart +++ b/test/src/models/algo_scrypt_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = AlgoScrypt.fromMap(map); - expect(result.type, 'scrypt'); - expect(result.costCpu, 8); - expect(result.costMemory, 14); - expect(result.costParallel, 1); - expect(result.length, 64); - }); + expect(result.type, 'scrypt'); + expect(result.costCpu, 8); + expect(result.costMemory, 14); + expect(result.costParallel, 1); + expect(result.length, 64); + }); }); } diff --git a/test/src/models/algo_sha_test.dart b/test/src/models/algo_sha_test.dart index ea1ec869..ff27754e 100644 --- a/test/src/models/algo_sha_test.dart +++ b/test/src/models/algo_sha_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoSha.fromMap(map); - expect(result.type, 'sha'); - }); + expect(result.type, 'sha'); + }); }); } diff --git a/test/src/models/attribute_bigint_test.dart b/test/src/models/attribute_bigint_test.dart new file mode 100644 index 00000000..1cce6f25 --- /dev/null +++ b/test/src/models/attribute_bigint_test.dart @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:dart_appwrite/enums.dart'; +import 'package:test/test.dart'; + +void main() { + group('AttributeBigint', () { + test('model', () { + final model = AttributeBigint( + key: 'count', + type: 'bigint', + status: AttributeStatus.available, + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + ); + + final map = model.toMap(); + final result = AttributeBigint.fromMap(map); + + expect(result.key, 'count'); + expect(result.type, 'bigint'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); + }); +} diff --git a/test/src/models/attribute_boolean_test.dart b/test/src/models/attribute_boolean_test.dart index 61595d2b..4e1ebb05 100644 --- a/test/src/models/attribute_boolean_test.dart +++ b/test/src/models/attribute_boolean_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeBoolean.fromMap(map); - expect(result.key, 'isEnabled'); - expect(result.type, 'boolean'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'isEnabled'); + expect(result.type, 'boolean'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_datetime_test.dart b/test/src/models/attribute_datetime_test.dart index d2e3aa2e..5ae8fa00 100644 --- a/test/src/models/attribute_datetime_test.dart +++ b/test/src/models/attribute_datetime_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeDatetime.fromMap(map); - expect(result.key, 'birthDay'); - expect(result.type, 'datetime'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'datetime'); - }); + expect(result.key, 'birthDay'); + expect(result.type, 'datetime'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'datetime'); + }); }); } diff --git a/test/src/models/attribute_email_test.dart b/test/src/models/attribute_email_test.dart index 82b70b38..5d8ecea7 100644 --- a/test/src/models/attribute_email_test.dart +++ b/test/src/models/attribute_email_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeEmail.fromMap(map); - expect(result.key, 'userEmail'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'email'); - }); + expect(result.key, 'userEmail'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'email'); + }); }); } diff --git a/test/src/models/attribute_enum_test.dart b/test/src/models/attribute_enum_test.dart index 2df66e1a..5bffd427 100644 --- a/test/src/models/attribute_enum_test.dart +++ b/test/src/models/attribute_enum_test.dart @@ -20,15 +20,15 @@ void main() { final map = model.toMap(); final result = AttributeEnum.fromMap(map); - expect(result.key, 'status'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.elements, []); - expect(result.format, 'enum'); - }); + expect(result.key, 'status'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.elements, []); + expect(result.format, 'enum'); + }); }); } diff --git a/test/src/models/attribute_float_test.dart b/test/src/models/attribute_float_test.dart index c935ab38..ade52316 100644 --- a/test/src/models/attribute_float_test.dart +++ b/test/src/models/attribute_float_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeFloat.fromMap(map); - expect(result.key, 'percentageCompleted'); - expect(result.type, 'double'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'percentageCompleted'); + expect(result.type, 'double'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_integer_test.dart b/test/src/models/attribute_integer_test.dart index 1c507a7d..c5241be4 100644 --- a/test/src/models/attribute_integer_test.dart +++ b/test/src/models/attribute_integer_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeInteger.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'integer'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'count'); + expect(result.type, 'integer'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_ip_test.dart b/test/src/models/attribute_ip_test.dart index c1cd14bb..9b808863 100644 --- a/test/src/models/attribute_ip_test.dart +++ b/test/src/models/attribute_ip_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeIp.fromMap(map); - expect(result.key, 'ipAddress'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'ip'); - }); + expect(result.key, 'ipAddress'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'ip'); + }); }); } diff --git a/test/src/models/attribute_line_test.dart b/test/src/models/attribute_line_test.dart index a51422e2..c1924a5d 100644 --- a/test/src/models/attribute_line_test.dart +++ b/test/src/models/attribute_line_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeLine.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_list_test.dart b/test/src/models/attribute_list_test.dart index 93e033ee..3b2384ff 100644 --- a/test/src/models/attribute_list_test.dart +++ b/test/src/models/attribute_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = AttributeList.fromMap(map); - expect(result.total, 5); - expect(result.attributes, []); - }); + expect(result.total, 5); + expect(result.attributes, []); + }); }); } diff --git a/test/src/models/attribute_longtext_test.dart b/test/src/models/attribute_longtext_test.dart index 4f58177f..794ab5dc 100644 --- a/test/src/models/attribute_longtext_test.dart +++ b/test/src/models/attribute_longtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeLongtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_mediumtext_test.dart b/test/src/models/attribute_mediumtext_test.dart index 53722e21..5bc9e400 100644 --- a/test/src/models/attribute_mediumtext_test.dart +++ b/test/src/models/attribute_mediumtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeMediumtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_point_test.dart b/test/src/models/attribute_point_test.dart index fe3d52ac..2f90d374 100644 --- a/test/src/models/attribute_point_test.dart +++ b/test/src/models/attribute_point_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributePoint.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_polygon_test.dart b/test/src/models/attribute_polygon_test.dart index 5c5df821..a4b452d1 100644 --- a/test/src/models/attribute_polygon_test.dart +++ b/test/src/models/attribute_polygon_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributePolygon.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_relationship_test.dart b/test/src/models/attribute_relationship_test.dart index 8776dffc..2bccd34c 100644 --- a/test/src/models/attribute_relationship_test.dart +++ b/test/src/models/attribute_relationship_test.dart @@ -24,19 +24,19 @@ void main() { final map = model.toMap(); final result = AttributeRelationship.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.relatedCollection, 'collection'); - expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); - expect(result.twoWay, true); - expect(result.twoWayKey, 'string'); - expect(result.onDelete, 'restrict|cascade|setNull'); - expect(result.side, 'parent|child'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.relatedCollection, 'collection'); + expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); + expect(result.twoWay, true); + expect(result.twoWayKey, 'string'); + expect(result.onDelete, 'restrict|cascade|setNull'); + expect(result.side, 'parent|child'); + }); }); } diff --git a/test/src/models/attribute_string_test.dart b/test/src/models/attribute_string_test.dart index 56f9e29e..8f92eb26 100644 --- a/test/src/models/attribute_string_test.dart +++ b/test/src/models/attribute_string_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeString.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/attribute_text_test.dart b/test/src/models/attribute_text_test.dart index b8fe6afc..96d57a55 100644 --- a/test/src/models/attribute_text_test.dart +++ b/test/src/models/attribute_text_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeText.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_url_test.dart b/test/src/models/attribute_url_test.dart index 24d4c99d..cc751748 100644 --- a/test/src/models/attribute_url_test.dart +++ b/test/src/models/attribute_url_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeUrl.fromMap(map); - expect(result.key, 'githubUrl'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'url'); - }); + expect(result.key, 'githubUrl'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'url'); + }); }); } diff --git a/test/src/models/attribute_varchar_test.dart b/test/src/models/attribute_varchar_test.dart index b0c175d8..536b42a5 100644 --- a/test/src/models/attribute_varchar_test.dart +++ b/test/src/models/attribute_varchar_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeVarchar.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/auth_provider_test.dart b/test/src/models/auth_provider_test.dart index 90191db8..e1c237f8 100644 --- a/test/src/models/auth_provider_test.dart +++ b/test/src/models/auth_provider_test.dart @@ -8,18 +8,18 @@ void main() { key: 'github', name: 'GitHub', appId: '259125845563242502', - secret: 'Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ', + secret: '', enabled: true, ); final map = model.toMap(); final result = AuthProvider.fromMap(map); - expect(result.key, 'github'); - expect(result.name, 'GitHub'); - expect(result.appId, '259125845563242502'); - expect(result.secret, 'Bpw_g9c2TGXxfgLshDbSaL8tsCcqgczQ'); - expect(result.enabled, true); - }); + expect(result.key, 'github'); + expect(result.name, 'GitHub'); + expect(result.appId, '259125845563242502'); + expect(result.secret, ''); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/backup_archive_list_test.dart b/test/src/models/backup_archive_list_test.dart index 39f02daf..8f1e4edb 100644 --- a/test/src/models/backup_archive_list_test.dart +++ b/test/src/models/backup_archive_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BackupArchiveList.fromMap(map); - expect(result.total, 5); - expect(result.archives, []); - }); + expect(result.total, 5); + expect(result.archives, []); + }); }); } diff --git a/test/src/models/backup_archive_test.dart b/test/src/models/backup_archive_test.dart index ddea414d..1d8d9b85 100644 --- a/test/src/models/backup_archive_test.dart +++ b/test/src/models/backup_archive_test.dart @@ -20,16 +20,16 @@ void main() { final map = model.toMap(); final result = BackupArchive.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.policyId, 'did8jx6ws45jana098ab7'); - expect(result.size, 100000); - expect(result.status, 'completed'); - expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.migrationId, 'did8jx6ws45jana098ab7'); - expect(result.services, []); - expect(result.resources, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.policyId, 'did8jx6ws45jana098ab7'); + expect(result.size, 100000); + expect(result.status, 'completed'); + expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.migrationId, 'did8jx6ws45jana098ab7'); + expect(result.services, []); + expect(result.resources, []); + }); }); } diff --git a/test/src/models/backup_policy_list_test.dart b/test/src/models/backup_policy_list_test.dart index c489e802..97c13eba 100644 --- a/test/src/models/backup_policy_list_test.dart +++ b/test/src/models/backup_policy_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BackupPolicyList.fromMap(map); - expect(result.total, 5); - expect(result.policies, []); - }); + expect(result.total, 5); + expect(result.policies, []); + }); }); } diff --git a/test/src/models/backup_policy_test.dart b/test/src/models/backup_policy_test.dart index 8f0731c1..554eacb7 100644 --- a/test/src/models/backup_policy_test.dart +++ b/test/src/models/backup_policy_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = BackupPolicy.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.name, 'Hourly backups'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.services, []); - expect(result.resources, []); - expect(result.retention, 7); - expect(result.schedule, '0 * * * *'); - expect(result.enabled, true); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.name, 'Hourly backups'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.services, []); + expect(result.resources, []); + expect(result.retention, 7); + expect(result.schedule, '0 * * * *'); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/backup_restoration_list_test.dart b/test/src/models/backup_restoration_list_test.dart index 2b356a16..8168498e 100644 --- a/test/src/models/backup_restoration_list_test.dart +++ b/test/src/models/backup_restoration_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BackupRestorationList.fromMap(map); - expect(result.total, 5); - expect(result.restorations, []); - }); + expect(result.total, 5); + expect(result.restorations, []); + }); }); } diff --git a/test/src/models/backup_restoration_test.dart b/test/src/models/backup_restoration_test.dart index b3b6f316..9012bb33 100644 --- a/test/src/models/backup_restoration_test.dart +++ b/test/src/models/backup_restoration_test.dart @@ -21,17 +21,17 @@ void main() { final map = model.toMap(); final result = BackupRestoration.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.archiveId, 'did8jx6ws45jana098ab7'); - expect(result.policyId, 'did8jx6ws45jana098ab7'); - expect(result.status, 'completed'); - expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.migrationId, 'did8jx6ws45jana098ab7'); - expect(result.services, []); - expect(result.resources, []); - expect(result.options, '{databases.database[{oldId, newId, newName}]}'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.archiveId, 'did8jx6ws45jana098ab7'); + expect(result.policyId, 'did8jx6ws45jana098ab7'); + expect(result.status, 'completed'); + expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.migrationId, 'did8jx6ws45jana098ab7'); + expect(result.services, []); + expect(result.resources, []); + expect(result.options, '{databases.database[{oldId, newId, newName}]}'); + }); }); } diff --git a/test/src/models/billing_limits_test.dart b/test/src/models/billing_limits_test.dart index 3ca637d1..2bcbdb01 100644 --- a/test/src/models/billing_limits_test.dart +++ b/test/src/models/billing_limits_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = BillingLimits.fromMap(map); - expect(result.bandwidth, 5); - expect(result.storage, 150); - expect(result.users, 200000); - expect(result.executions, 750000); - expect(result.GBHours, 100); - expect(result.imageTransformations, 100); - expect(result.authPhone, 10); - expect(result.budgetLimit, 100); - }); + expect(result.bandwidth, 5); + expect(result.storage, 150); + expect(result.users, 200000); + expect(result.executions, 750000); + expect(result.GBHours, 100); + expect(result.imageTransformations, 100); + expect(result.authPhone, 10); + expect(result.budgetLimit, 100); + }); }); } diff --git a/test/src/models/block_test.dart b/test/src/models/block_test.dart index e407398a..fa9f3a24 100644 --- a/test/src/models/block_test.dart +++ b/test/src/models/block_test.dart @@ -8,14 +8,24 @@ void main() { $createdAt: '2020-10-15T06:38:00.000+00:00', resourceType: 'project', resourceId: '5e5ea5c16897e', + projectName: 'My Project', + region: 'fra', + organizationName: 'Acme Inc.', + organizationId: '5e5ea5c16897e', + billingPlan: 'pro', ); final map = model.toMap(); final result = Block.fromMap(map); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.resourceType, 'project'); - expect(result.resourceId, '5e5ea5c16897e'); - }); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.resourceType, 'project'); + expect(result.resourceId, '5e5ea5c16897e'); + expect(result.projectName, 'My Project'); + expect(result.region, 'fra'); + expect(result.organizationName, 'Acme Inc.'); + expect(result.organizationId, '5e5ea5c16897e'); + expect(result.billingPlan, 'pro'); + }); }); } diff --git a/test/src/models/bucket_list_test.dart b/test/src/models/bucket_list_test.dart index bb1ae4c6..b1200cb6 100644 --- a/test/src/models/bucket_list_test.dart +++ b/test/src/models/bucket_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BucketList.fromMap(map); - expect(result.total, 5); - expect(result.buckets, []); - }); + expect(result.total, 5); + expect(result.buckets, []); + }); }); } diff --git a/test/src/models/bucket_test.dart b/test/src/models/bucket_test.dart index b1448177..766ed86d 100644 --- a/test/src/models/bucket_test.dart +++ b/test/src/models/bucket_test.dart @@ -24,20 +24,20 @@ void main() { final map = model.toMap(); final result = Bucket.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.fileSecurity, true); - expect(result.name, 'Documents'); - expect(result.enabled, true); - expect(result.maximumFileSize, 100); - expect(result.allowedFileExtensions, []); - expect(result.compression, 'gzip'); - expect(result.encryption, true); - expect(result.antivirus, true); - expect(result.transformations, true); - expect(result.totalSize, 128); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.fileSecurity, true); + expect(result.name, 'Documents'); + expect(result.enabled, true); + expect(result.maximumFileSize, 100); + expect(result.allowedFileExtensions, []); + expect(result.compression, 'gzip'); + expect(result.encryption, true); + expect(result.antivirus, true); + expect(result.transformations, true); + expect(result.totalSize, 128); + }); }); } diff --git a/test/src/models/collection_list_test.dart b/test/src/models/collection_list_test.dart index ef952c70..4ba89d51 100644 --- a/test/src/models/collection_list_test.dart +++ b/test/src/models/collection_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = CollectionList.fromMap(map); - expect(result.total, 5); - expect(result.collections, []); - }); + expect(result.total, 5); + expect(result.collections, []); + }); }); } diff --git a/test/src/models/collection_test.dart b/test/src/models/collection_test.dart index f41cd169..87c53498 100644 --- a/test/src/models/collection_test.dart +++ b/test/src/models/collection_test.dart @@ -22,18 +22,18 @@ void main() { final map = model.toMap(); final result = Collection.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.databaseId, '5e5ea5c16897e'); - expect(result.name, 'My Collection'); - expect(result.enabled, true); - expect(result.documentSecurity, true); - expect(result.attributes, []); - expect(result.indexes, []); - expect(result.bytesMax, 65535); - expect(result.bytesUsed, 1500); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.databaseId, '5e5ea5c16897e'); + expect(result.name, 'My Collection'); + expect(result.enabled, true); + expect(result.documentSecurity, true); + expect(result.attributes, []); + expect(result.indexes, []); + expect(result.bytesMax, 65535); + expect(result.bytesUsed, 1500); + }); }); } diff --git a/test/src/models/column_bigint_test.dart b/test/src/models/column_bigint_test.dart new file mode 100644 index 00000000..fa5cec4a --- /dev/null +++ b/test/src/models/column_bigint_test.dart @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:dart_appwrite/enums.dart'; +import 'package:test/test.dart'; + +void main() { + group('ColumnBigint', () { + test('model', () { + final model = ColumnBigint( + key: 'count', + type: 'bigint', + status: ColumnStatus.available, + error: 'string', + xrequired: true, + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + ); + + final map = model.toMap(); + final result = ColumnBigint.fromMap(map); + + expect(result.key, 'count'); + expect(result.type, 'bigint'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); + }); +} diff --git a/test/src/models/column_boolean_test.dart b/test/src/models/column_boolean_test.dart index cd128d10..c0c52eaf 100644 --- a/test/src/models/column_boolean_test.dart +++ b/test/src/models/column_boolean_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnBoolean.fromMap(map); - expect(result.key, 'isEnabled'); - expect(result.type, 'boolean'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'isEnabled'); + expect(result.type, 'boolean'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_datetime_test.dart b/test/src/models/column_datetime_test.dart index 109c16c3..5f8995b0 100644 --- a/test/src/models/column_datetime_test.dart +++ b/test/src/models/column_datetime_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnDatetime.fromMap(map); - expect(result.key, 'birthDay'); - expect(result.type, 'datetime'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'datetime'); - }); + expect(result.key, 'birthDay'); + expect(result.type, 'datetime'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'datetime'); + }); }); } diff --git a/test/src/models/column_email_test.dart b/test/src/models/column_email_test.dart index 9bc520be..9047dc81 100644 --- a/test/src/models/column_email_test.dart +++ b/test/src/models/column_email_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnEmail.fromMap(map); - expect(result.key, 'userEmail'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'email'); - }); + expect(result.key, 'userEmail'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'email'); + }); }); } diff --git a/test/src/models/column_enum_test.dart b/test/src/models/column_enum_test.dart index 2a229ba0..b27fa78a 100644 --- a/test/src/models/column_enum_test.dart +++ b/test/src/models/column_enum_test.dart @@ -20,15 +20,15 @@ void main() { final map = model.toMap(); final result = ColumnEnum.fromMap(map); - expect(result.key, 'status'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.elements, []); - expect(result.format, 'enum'); - }); + expect(result.key, 'status'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.elements, []); + expect(result.format, 'enum'); + }); }); } diff --git a/test/src/models/column_float_test.dart b/test/src/models/column_float_test.dart index e2503b06..5d8fc98f 100644 --- a/test/src/models/column_float_test.dart +++ b/test/src/models/column_float_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnFloat.fromMap(map); - expect(result.key, 'percentageCompleted'); - expect(result.type, 'double'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'percentageCompleted'); + expect(result.type, 'double'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_index_list_test.dart b/test/src/models/column_index_list_test.dart index aae59124..571793aa 100644 --- a/test/src/models/column_index_list_test.dart +++ b/test/src/models/column_index_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ColumnIndexList.fromMap(map); - expect(result.total, 5); - expect(result.indexes, []); - }); + expect(result.total, 5); + expect(result.indexes, []); + }); }); } diff --git a/test/src/models/column_index_test.dart b/test/src/models/column_index_test.dart index 8277048d..daa40c71 100644 --- a/test/src/models/column_index_test.dart +++ b/test/src/models/column_index_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = ColumnIndex.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.key, 'index1'); - expect(result.type, 'primary'); - expect(result.status, 'available'); - expect(result.error, 'string'); - expect(result.columns, []); - expect(result.lengths, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.key, 'index1'); + expect(result.type, 'primary'); + expect(result.status, 'available'); + expect(result.error, 'string'); + expect(result.columns, []); + expect(result.lengths, []); + }); }); } diff --git a/test/src/models/column_integer_test.dart b/test/src/models/column_integer_test.dart index 1a411804..ee484733 100644 --- a/test/src/models/column_integer_test.dart +++ b/test/src/models/column_integer_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnInteger.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'integer'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'count'); + expect(result.type, 'integer'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_ip_test.dart b/test/src/models/column_ip_test.dart index 9efe3295..8cde17c9 100644 --- a/test/src/models/column_ip_test.dart +++ b/test/src/models/column_ip_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnIp.fromMap(map); - expect(result.key, 'ipAddress'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'ip'); - }); + expect(result.key, 'ipAddress'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'ip'); + }); }); } diff --git a/test/src/models/column_line_test.dart b/test/src/models/column_line_test.dart index a290a8df..a4ffbdb4 100644 --- a/test/src/models/column_line_test.dart +++ b/test/src/models/column_line_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnLine.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_list_test.dart b/test/src/models/column_list_test.dart index c06d8a23..6d8be211 100644 --- a/test/src/models/column_list_test.dart +++ b/test/src/models/column_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ColumnList.fromMap(map); - expect(result.total, 5); - expect(result.columns, []); - }); + expect(result.total, 5); + expect(result.columns, []); + }); }); } diff --git a/test/src/models/column_longtext_test.dart b/test/src/models/column_longtext_test.dart index b4c1ad30..a227c789 100644 --- a/test/src/models/column_longtext_test.dart +++ b/test/src/models/column_longtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnLongtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_mediumtext_test.dart b/test/src/models/column_mediumtext_test.dart index 6c460c09..27d04b6b 100644 --- a/test/src/models/column_mediumtext_test.dart +++ b/test/src/models/column_mediumtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnMediumtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_point_test.dart b/test/src/models/column_point_test.dart index 43c13448..3467e248 100644 --- a/test/src/models/column_point_test.dart +++ b/test/src/models/column_point_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnPoint.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_polygon_test.dart b/test/src/models/column_polygon_test.dart index ef794b1b..a34ff03f 100644 --- a/test/src/models/column_polygon_test.dart +++ b/test/src/models/column_polygon_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnPolygon.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_relationship_test.dart b/test/src/models/column_relationship_test.dart index 58013bbe..a5b793de 100644 --- a/test/src/models/column_relationship_test.dart +++ b/test/src/models/column_relationship_test.dart @@ -24,19 +24,19 @@ void main() { final map = model.toMap(); final result = ColumnRelationship.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.relatedTable, 'table'); - expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); - expect(result.twoWay, true); - expect(result.twoWayKey, 'string'); - expect(result.onDelete, 'restrict|cascade|setNull'); - expect(result.side, 'parent|child'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.relatedTable, 'table'); + expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); + expect(result.twoWay, true); + expect(result.twoWayKey, 'string'); + expect(result.onDelete, 'restrict|cascade|setNull'); + expect(result.side, 'parent|child'); + }); }); } diff --git a/test/src/models/column_string_test.dart b/test/src/models/column_string_test.dart index af3ee616..49816f92 100644 --- a/test/src/models/column_string_test.dart +++ b/test/src/models/column_string_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnString.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/column_text_test.dart b/test/src/models/column_text_test.dart index 2055d538..b0900197 100644 --- a/test/src/models/column_text_test.dart +++ b/test/src/models/column_text_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnText.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_url_test.dart b/test/src/models/column_url_test.dart index 723a1306..671b940e 100644 --- a/test/src/models/column_url_test.dart +++ b/test/src/models/column_url_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnUrl.fromMap(map); - expect(result.key, 'githubUrl'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'url'); - }); + expect(result.key, 'githubUrl'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'url'); + }); }); } diff --git a/test/src/models/column_varchar_test.dart b/test/src/models/column_varchar_test.dart index 7cc4424a..e805ac09 100644 --- a/test/src/models/column_varchar_test.dart +++ b/test/src/models/column_varchar_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnVarchar.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/continent_list_test.dart b/test/src/models/continent_list_test.dart index 6b139f4d..2f78416f 100644 --- a/test/src/models/continent_list_test.dart +++ b/test/src/models/continent_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ContinentList.fromMap(map); - expect(result.total, 5); - expect(result.continents, []); - }); + expect(result.total, 5); + expect(result.continents, []); + }); }); } diff --git a/test/src/models/continent_test.dart b/test/src/models/continent_test.dart index 656cc010..1cf934a3 100644 --- a/test/src/models/continent_test.dart +++ b/test/src/models/continent_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = Continent.fromMap(map); - expect(result.name, 'Europe'); - expect(result.code, 'EU'); - }); + expect(result.name, 'Europe'); + expect(result.code, 'EU'); + }); }); } diff --git a/test/src/models/country_list_test.dart b/test/src/models/country_list_test.dart index 71b0d477..1c5ee7cc 100644 --- a/test/src/models/country_list_test.dart +++ b/test/src/models/country_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = CountryList.fromMap(map); - expect(result.total, 5); - expect(result.countries, []); - }); + expect(result.total, 5); + expect(result.countries, []); + }); }); } diff --git a/test/src/models/country_test.dart b/test/src/models/country_test.dart index f4eec5ee..f41d3cdb 100644 --- a/test/src/models/country_test.dart +++ b/test/src/models/country_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = Country.fromMap(map); - expect(result.name, 'United States'); - expect(result.code, 'US'); - }); + expect(result.name, 'United States'); + expect(result.code, 'US'); + }); }); } diff --git a/test/src/models/currency_list_test.dart b/test/src/models/currency_list_test.dart index 36add198..3612e8b0 100644 --- a/test/src/models/currency_list_test.dart +++ b/test/src/models/currency_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = CurrencyList.fromMap(map); - expect(result.total, 5); - expect(result.currencies, []); - }); + expect(result.total, 5); + expect(result.currencies, []); + }); }); } diff --git a/test/src/models/currency_test.dart b/test/src/models/currency_test.dart index 05fef236..35e511f9 100644 --- a/test/src/models/currency_test.dart +++ b/test/src/models/currency_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = Currency.fromMap(map); - expect(result.symbol, '\$'); - expect(result.name, 'US dollar'); - expect(result.symbolNative, '\$'); - expect(result.decimalDigits, 2); - expect(result.rounding, 0); - expect(result.code, 'USD'); - expect(result.namePlural, 'US dollars'); - }); + expect(result.symbol, '\$'); + expect(result.name, 'US dollar'); + expect(result.symbolNative, '\$'); + expect(result.decimalDigits, 2); + expect(result.rounding, 0); + expect(result.code, 'USD'); + expect(result.namePlural, 'US dollars'); + }); }); } diff --git a/test/src/models/database_list_test.dart b/test/src/models/database_list_test.dart index ec1c0150..15e44083 100644 --- a/test/src/models/database_list_test.dart +++ b/test/src/models/database_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = DatabaseList.fromMap(map); - expect(result.total, 5); - expect(result.databases, []); - }); + expect(result.total, 5); + expect(result.databases, []); + }); }); } diff --git a/test/src/models/database_test.dart b/test/src/models/database_test.dart index fff6a7e2..bfbd8ae5 100644 --- a/test/src/models/database_test.dart +++ b/test/src/models/database_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = Database.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.name, 'My Database'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.enabled, true); - expect(result.type, DatabaseType.legacy); - expect(result.policies, []); - expect(result.archives, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.name, 'My Database'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.enabled, true); + expect(result.type, DatabaseType.legacy); + expect(result.policies, []); + expect(result.archives, []); + }); }); } diff --git a/test/src/models/deployment_list_test.dart b/test/src/models/deployment_list_test.dart index 64f2e6b9..a0689888 100644 --- a/test/src/models/deployment_list_test.dart +++ b/test/src/models/deployment_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = DeploymentList.fromMap(map); - expect(result.total, 5); - expect(result.deployments, []); - }); + expect(result.total, 5); + expect(result.deployments, []); + }); }); } diff --git a/test/src/models/deployment_test.dart b/test/src/models/deployment_test.dart index 956ea5a5..16f003b2 100644 --- a/test/src/models/deployment_test.dart +++ b/test/src/models/deployment_test.dart @@ -25,53 +25,46 @@ void main() { buildDuration: 128, providerRepositoryName: 'database', providerRepositoryOwner: 'utopia', - providerRepositoryUrl: - 'https://github.com/vermakhushboo/g4-node-function', + providerRepositoryUrl: 'https://github.com/vermakhushboo/g4-node-function', providerCommitHash: '7c3f25d', providerCommitAuthorUrl: 'https://github.com/vermakhushboo', providerCommitAuthor: 'Khushboo Verma', providerCommitMessage: 'Update index.js', - providerCommitUrl: - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerCommitUrl: 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', providerBranch: '0.7.x', - providerBranchUrl: - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + providerBranchUrl: 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', ); final map = model.toMap(); final result = Deployment.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.type, 'vcs'); - expect(result.resourceId, '5e5ea6g16897e'); - expect(result.resourceType, 'functions'); - expect(result.entrypoint, 'index.js'); - expect(result.sourceSize, 128); - expect(result.buildSize, 128); - expect(result.totalSize, 128); - expect(result.buildId, '5e5ea5c16897e'); - expect(result.activate, true); - expect(result.screenshotLight, '5e5ea5c16897e'); - expect(result.screenshotDark, '5e5ea5c16897e'); - expect(result.status, DeploymentStatus.waiting); - expect(result.buildLogs, 'Compiling source files...'); - expect(result.buildDuration, 128); - expect(result.providerRepositoryName, 'database'); - expect(result.providerRepositoryOwner, 'utopia'); - expect(result.providerRepositoryUrl, - 'https://github.com/vermakhushboo/g4-node-function'); - expect(result.providerCommitHash, '7c3f25d'); - expect( - result.providerCommitAuthorUrl, 'https://github.com/vermakhushboo'); - expect(result.providerCommitAuthor, 'Khushboo Verma'); - expect(result.providerCommitMessage, 'Update index.js'); - expect(result.providerCommitUrl, - 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb'); - expect(result.providerBranch, '0.7.x'); - expect(result.providerBranchUrl, - 'https://github.com/vermakhushboo/appwrite/tree/0.7.x'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.type, 'vcs'); + expect(result.resourceId, '5e5ea6g16897e'); + expect(result.resourceType, 'functions'); + expect(result.entrypoint, 'index.js'); + expect(result.sourceSize, 128); + expect(result.buildSize, 128); + expect(result.totalSize, 128); + expect(result.buildId, '5e5ea5c16897e'); + expect(result.activate, true); + expect(result.screenshotLight, '5e5ea5c16897e'); + expect(result.screenshotDark, '5e5ea5c16897e'); + expect(result.status, DeploymentStatus.waiting); + expect(result.buildLogs, 'Compiling source files...'); + expect(result.buildDuration, 128); + expect(result.providerRepositoryName, 'database'); + expect(result.providerRepositoryOwner, 'utopia'); + expect(result.providerRepositoryUrl, 'https://github.com/vermakhushboo/g4-node-function'); + expect(result.providerCommitHash, '7c3f25d'); + expect(result.providerCommitAuthorUrl, 'https://github.com/vermakhushboo'); + expect(result.providerCommitAuthor, 'Khushboo Verma'); + expect(result.providerCommitMessage, 'Update index.js'); + expect(result.providerCommitUrl, 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb'); + expect(result.providerBranch, '0.7.x'); + expect(result.providerBranchUrl, 'https://github.com/vermakhushboo/appwrite/tree/0.7.x'); + }); }); } diff --git a/test/src/models/dev_key_test.dart b/test/src/models/dev_key_test.dart index 3a318814..43460d50 100644 --- a/test/src/models/dev_key_test.dart +++ b/test/src/models/dev_key_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = DevKey.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'Dev API Key'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.sdks, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'Dev API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); }); } diff --git a/test/src/models/document_list_test.dart b/test/src/models/document_list_test.dart index 18ed1c09..b2dab5c4 100644 --- a/test/src/models/document_list_test.dart +++ b/test/src/models/document_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = DocumentList.fromMap(map); - expect(result.total, 5); - expect(result.documents, []); - }); + expect(result.total, 5); + expect(result.documents, []); + }); }); } diff --git a/test/src/models/document_test.dart b/test/src/models/document_test.dart index 5fbdc12c..4d0d7975 100644 --- a/test/src/models/document_test.dart +++ b/test/src/models/document_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = Document.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$sequence, '1'); - expect(result.$collectionId, '5e5ea5c15117e'); - expect(result.$databaseId, '5e5ea5c15117e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$collectionId, '5e5ea5c15117e'); + expect(result.$databaseId, '5e5ea5c15117e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + }); }); } diff --git a/test/src/models/email_template_list_test.dart b/test/src/models/email_template_list_test.dart new file mode 100644 index 00000000..d755c37f --- /dev/null +++ b/test/src/models/email_template_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('EmailTemplateList', () { + test('model', () { + final model = EmailTemplateList( + total: 5, + templates: [], + ); + + final map = model.toMap(); + final result = EmailTemplateList.fromMap(map); + + expect(result.total, 5); + expect(result.templates, []); + }); + }); +} diff --git a/test/src/models/email_template_test.dart b/test/src/models/email_template_test.dart new file mode 100644 index 00000000..8c257278 --- /dev/null +++ b/test/src/models/email_template_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('EmailTemplate', () { + test('model', () { + final model = EmailTemplate( + templateId: 'verification', + locale: 'en_us', + message: 'Click on the link to verify your account.', + senderName: 'My User', + senderEmail: 'mail@appwrite.io', + replyToEmail: 'emails@appwrite.io', + replyToName: 'Support Team', + subject: 'Please verify your email address', + ); + + final map = model.toMap(); + final result = EmailTemplate.fromMap(map); + + expect(result.templateId, 'verification'); + expect(result.locale, 'en_us'); + expect(result.message, 'Click on the link to verify your account.'); + expect(result.senderName, 'My User'); + expect(result.senderEmail, 'mail@appwrite.io'); + expect(result.replyToEmail, 'emails@appwrite.io'); + expect(result.replyToName, 'Support Team'); + expect(result.subject, 'Please verify your email address'); + }); + }); +} diff --git a/test/src/models/ephemeral_key_test.dart b/test/src/models/ephemeral_key_test.dart new file mode 100644 index 00000000..9b4c56b9 --- /dev/null +++ b/test/src/models/ephemeral_key_test.dart @@ -0,0 +1,33 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('EphemeralKey', () { + test('model', () { + final model = EphemeralKey( + $id: '5e5ea5c16897e', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + name: 'My API Key', + expire: '2020-10-15T06:38:00.000+00:00', + scopes: [], + secret: '919c2d18fb5d4...a2ae413da83346ad2', + accessedAt: '2020-10-15T06:38:00.000+00:00', + sdks: [], + ); + + final map = model.toMap(); + final result = EphemeralKey.fromMap(map); + + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.scopes, []); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); + }); +} diff --git a/test/src/models/execution_list_test.dart b/test/src/models/execution_list_test.dart index ba36364e..6bda2fa5 100644 --- a/test/src/models/execution_list_test.dart +++ b/test/src/models/execution_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ExecutionList.fromMap(map); - expect(result.total, 5); - expect(result.executions, []); - }); + expect(result.total, 5); + expect(result.executions, []); + }); }); } diff --git a/test/src/models/execution_test.dart b/test/src/models/execution_test.dart index 53b36c9e..0e1b7b9c 100644 --- a/test/src/models/execution_test.dart +++ b/test/src/models/execution_test.dart @@ -28,23 +28,23 @@ void main() { final map = model.toMap(); final result = Execution.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.functionId, '5e5ea6g16897e'); - expect(result.deploymentId, '5e5ea5c16897e'); - expect(result.trigger, ExecutionTrigger.http); - expect(result.status, ExecutionStatus.waiting); - expect(result.requestMethod, 'GET'); - expect(result.requestPath, '/articles?id=5'); - expect(result.requestHeaders, []); - expect(result.responseStatusCode, 200); - expect(result.responseBody, ''); - expect(result.responseHeaders, []); - expect(result.logs, ''); - expect(result.errors, ''); - expect(result.duration, 0.4); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.functionId, '5e5ea6g16897e'); + expect(result.deploymentId, '5e5ea5c16897e'); + expect(result.trigger, ExecutionTrigger.http); + expect(result.status, ExecutionStatus.waiting); + expect(result.requestMethod, 'GET'); + expect(result.requestPath, '/articles?id=5'); + expect(result.requestHeaders, []); + expect(result.responseStatusCode, 200); + expect(result.responseBody, ''); + expect(result.responseHeaders, []); + expect(result.logs, ''); + expect(result.errors, ''); + expect(result.duration, 0.4); + }); }); } diff --git a/test/src/models/file_list_test.dart b/test/src/models/file_list_test.dart index 132c43b3..c60fac86 100644 --- a/test/src/models/file_list_test.dart +++ b/test/src/models/file_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = FileList.fromMap(map); - expect(result.total, 5); - expect(result.files, []); - }); + expect(result.total, 5); + expect(result.files, []); + }); }); } diff --git a/test/src/models/file_test.dart b/test/src/models/file_test.dart index c515412d..ba229c32 100644 --- a/test/src/models/file_test.dart +++ b/test/src/models/file_test.dart @@ -23,19 +23,19 @@ void main() { final map = model.toMap(); final result = File.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.bucketId, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.name, 'Pink.png'); - expect(result.signature, '5d529fd02b544198ae075bd57c1762bb'); - expect(result.mimeType, 'image/png'); - expect(result.sizeOriginal, 17890); - expect(result.chunksTotal, 17890); - expect(result.chunksUploaded, 17890); - expect(result.encryption, true); - expect(result.compression, 'gzip'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.bucketId, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.name, 'Pink.png'); + expect(result.signature, '5d529fd02b544198ae075bd57c1762bb'); + expect(result.mimeType, 'image/png'); + expect(result.sizeOriginal, 17890); + expect(result.chunksTotal, 17890); + expect(result.chunksUploaded, 17890); + expect(result.encryption, true); + expect(result.compression, 'gzip'); + }); }); } diff --git a/test/src/models/framework_adapter_test.dart b/test/src/models/framework_adapter_test.dart index e892cf0d..a7b5ed65 100644 --- a/test/src/models/framework_adapter_test.dart +++ b/test/src/models/framework_adapter_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = FrameworkAdapter.fromMap(map); - expect(result.key, 'static'); - expect(result.installCommand, 'npm install'); - expect(result.buildCommand, 'npm run build'); - expect(result.outputDirectory, './dist'); - expect(result.fallbackFile, 'index.html'); - }); + expect(result.key, 'static'); + expect(result.installCommand, 'npm install'); + expect(result.buildCommand, 'npm run build'); + expect(result.outputDirectory, './dist'); + expect(result.fallbackFile, 'index.html'); + }); }); } diff --git a/test/src/models/framework_list_test.dart b/test/src/models/framework_list_test.dart index faeae12a..7b2a29b8 100644 --- a/test/src/models/framework_list_test.dart +++ b/test/src/models/framework_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = FrameworkList.fromMap(map); - expect(result.total, 5); - expect(result.frameworks, []); - }); + expect(result.total, 5); + expect(result.frameworks, []); + }); }); } diff --git a/test/src/models/framework_test.dart b/test/src/models/framework_test.dart index 07ce1e79..20744ab0 100644 --- a/test/src/models/framework_test.dart +++ b/test/src/models/framework_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = Framework.fromMap(map); - expect(result.key, 'sveltekit'); - expect(result.name, 'SvelteKit'); - expect(result.buildRuntime, 'node-22'); - expect(result.runtimes, []); - expect(result.adapters, []); - }); + expect(result.key, 'sveltekit'); + expect(result.name, 'SvelteKit'); + expect(result.buildRuntime, 'node-22'); + expect(result.runtimes, []); + expect(result.adapters, []); + }); }); } diff --git a/test/src/models/function_list_test.dart b/test/src/models/function_list_test.dart index 81a86955..2d4d974d 100644 --- a/test/src/models/function_list_test.dart +++ b/test/src/models/function_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = FunctionList.fromMap(map); - expect(result.total, 5); - expect(result.functions, []); - }); + expect(result.total, 5); + expect(result.functions, []); + }); }); } diff --git a/test/src/models/function_test.dart b/test/src/models/function_test.dart index 8a0dfb7e..e11a724f 100644 --- a/test/src/models/function_test.dart +++ b/test/src/models/function_test.dart @@ -40,36 +40,36 @@ void main() { final map = model.toMap(); final result = Func.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.execute, []); - expect(result.name, 'My Function'); - expect(result.enabled, true); - expect(result.live, true); - expect(result.logging, true); - expect(result.runtime, 'python-3.8'); - expect(result.deploymentRetention, 7); - expect(result.deploymentId, '5e5ea5c16897e'); - expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.latestDeploymentId, '5e5ea5c16897e'); - expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.latestDeploymentStatus, 'ready'); - expect(result.scopes, []); - expect(result.vars, []); - expect(result.events, []); - expect(result.schedule, '5 4 * * *'); - expect(result.timeout, 300); - expect(result.entrypoint, 'index.js'); - expect(result.commands, 'npm install'); - expect(result.version, 'v2'); - expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); - expect(result.providerRepositoryId, 'appwrite'); - expect(result.providerBranch, 'main'); - expect(result.providerRootDirectory, 'functions/helloWorld'); - expect(result.providerSilentMode, true); - expect(result.buildSpecification, 's-1vcpu-512mb'); - expect(result.runtimeSpecification, 's-1vcpu-512mb'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.execute, []); + expect(result.name, 'My Function'); + expect(result.enabled, true); + expect(result.live, true); + expect(result.logging, true); + expect(result.runtime, 'python-3.8'); + expect(result.deploymentRetention, 7); + expect(result.deploymentId, '5e5ea5c16897e'); + expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.latestDeploymentId, '5e5ea5c16897e'); + expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.latestDeploymentStatus, 'ready'); + expect(result.scopes, []); + expect(result.vars, []); + expect(result.events, []); + expect(result.schedule, '5 4 * * *'); + expect(result.timeout, 300); + expect(result.entrypoint, 'index.js'); + expect(result.commands, 'npm install'); + expect(result.version, 'v2'); + expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); + expect(result.providerRepositoryId, 'appwrite'); + expect(result.providerBranch, 'main'); + expect(result.providerRootDirectory, 'functions/helloWorld'); + expect(result.providerSilentMode, true); + expect(result.buildSpecification, 's-1vcpu-512mb'); + expect(result.runtimeSpecification, 's-1vcpu-512mb'); + }); }); } diff --git a/test/src/models/headers_test.dart b/test/src/models/headers_test.dart index 1d79dcad..d3abb67f 100644 --- a/test/src/models/headers_test.dart +++ b/test/src/models/headers_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = Headers.fromMap(map); - expect(result.name, 'Content-Type'); - expect(result.value, 'application/json'); - }); + expect(result.name, 'Content-Type'); + expect(result.value, 'application/json'); + }); }); } diff --git a/test/src/models/health_antivirus_test.dart b/test/src/models/health_antivirus_test.dart index 69628d5d..d09a016b 100644 --- a/test/src/models/health_antivirus_test.dart +++ b/test/src/models/health_antivirus_test.dart @@ -13,8 +13,8 @@ void main() { final map = model.toMap(); final result = HealthAntivirus.fromMap(map); - expect(result.version, '1.0.0'); - expect(result.status, HealthAntivirusStatus.disabled); - }); + expect(result.version, '1.0.0'); + expect(result.status, HealthAntivirusStatus.disabled); + }); }); } diff --git a/test/src/models/health_certificate_test.dart b/test/src/models/health_certificate_test.dart index 3a6f1d4c..9915fd80 100644 --- a/test/src/models/health_certificate_test.dart +++ b/test/src/models/health_certificate_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = HealthCertificate.fromMap(map); - expect(result.name, '/CN=www.google.com'); - expect(result.subjectSN, ''); - expect(result.issuerOrganisation, ''); - expect(result.validFrom, '1704200998'); - expect(result.validTo, '1711458597'); - expect(result.signatureTypeSN, 'RSA-SHA256'); - }); + expect(result.name, '/CN=www.google.com'); + expect(result.subjectSN, ''); + expect(result.issuerOrganisation, ''); + expect(result.validFrom, '1704200998'); + expect(result.validTo, '1711458597'); + expect(result.signatureTypeSN, 'RSA-SHA256'); + }); }); } diff --git a/test/src/models/health_queue_test.dart b/test/src/models/health_queue_test.dart index 3cb77741..ab040ebd 100644 --- a/test/src/models/health_queue_test.dart +++ b/test/src/models/health_queue_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = HealthQueue.fromMap(map); - expect(result.size, 8); - }); + expect(result.size, 8); + }); }); } diff --git a/test/src/models/health_status_list_test.dart b/test/src/models/health_status_list_test.dart index d14468c8..a03756b0 100644 --- a/test/src/models/health_status_list_test.dart +++ b/test/src/models/health_status_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = HealthStatusList.fromMap(map); - expect(result.total, 5); - expect(result.statuses, []); - }); + expect(result.total, 5); + expect(result.statuses, []); + }); }); } diff --git a/test/src/models/health_status_test.dart b/test/src/models/health_status_test.dart index 4952b462..e98c788f 100644 --- a/test/src/models/health_status_test.dart +++ b/test/src/models/health_status_test.dart @@ -14,9 +14,9 @@ void main() { final map = model.toMap(); final result = HealthStatus.fromMap(map); - expect(result.name, 'database'); - expect(result.ping, 128); - expect(result.status, HealthCheckStatus.pass); - }); + expect(result.name, 'database'); + expect(result.ping, 128); + expect(result.status, HealthCheckStatus.pass); + }); }); } diff --git a/test/src/models/health_time_test.dart b/test/src/models/health_time_test.dart index 12998d00..2455d9cd 100644 --- a/test/src/models/health_time_test.dart +++ b/test/src/models/health_time_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = HealthTime.fromMap(map); - expect(result.remoteTime, 1639490751); - expect(result.localTime, 1639490844); - expect(result.diff, 93); - }); + expect(result.remoteTime, 1639490751); + expect(result.localTime, 1639490844); + expect(result.diff, 93); + }); }); } diff --git a/test/src/models/identity_list_test.dart b/test/src/models/identity_list_test.dart index d3bf6876..d3d477be 100644 --- a/test/src/models/identity_list_test.dart +++ b/test/src/models/identity_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = IdentityList.fromMap(map); - expect(result.total, 5); - expect(result.identities, []); - }); + expect(result.total, 5); + expect(result.identities, []); + }); }); } diff --git a/test/src/models/identity_test.dart b/test/src/models/identity_test.dart index 680b7497..3826d358 100644 --- a/test/src/models/identity_test.dart +++ b/test/src/models/identity_test.dart @@ -20,16 +20,16 @@ void main() { final map = model.toMap(); final result = Identity.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5bb8c16897e'); - expect(result.provider, 'email'); - expect(result.providerUid, '5e5bb8c16897e'); - expect(result.providerEmail, 'user@example.com'); - expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); - expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5bb8c16897e'); + expect(result.provider, 'email'); + expect(result.providerUid, '5e5bb8c16897e'); + expect(result.providerEmail, 'user@example.com'); + expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); + expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + }); }); } diff --git a/test/src/models/index_list_test.dart b/test/src/models/index_list_test.dart index 07b7e4d1..fb68500c 100644 --- a/test/src/models/index_list_test.dart +++ b/test/src/models/index_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = IndexList.fromMap(map); - expect(result.total, 5); - expect(result.indexes, []); - }); + expect(result.total, 5); + expect(result.indexes, []); + }); }); } diff --git a/test/src/models/index_test.dart b/test/src/models/index_test.dart index c6a23779..922976a3 100644 --- a/test/src/models/index_test.dart +++ b/test/src/models/index_test.dart @@ -20,15 +20,15 @@ void main() { final map = model.toMap(); final result = Index.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.key, 'index1'); - expect(result.type, 'primary'); - expect(result.status, IndexStatus.available); - expect(result.error, 'string'); - expect(result.attributes, []); - expect(result.lengths, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.key, 'index1'); + expect(result.type, 'primary'); + expect(result.status, IndexStatus.available); + expect(result.error, 'string'); + expect(result.attributes, []); + expect(result.lengths, []); + }); }); } diff --git a/test/src/models/jwt_test.dart b/test/src/models/jwt_test.dart index c6b2df28..a45857b3 100644 --- a/test/src/models/jwt_test.dart +++ b/test/src/models/jwt_test.dart @@ -5,15 +5,13 @@ void main() { group('Jwt', () { test('model', () { final model = Jwt( - jwt: - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', ); final map = model.toMap(); final result = Jwt.fromMap(map); - expect(result.jwt, - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); - }); + expect(result.jwt, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); + }); }); } diff --git a/test/src/models/key_list_test.dart b/test/src/models/key_list_test.dart index 97747078..cdea8b07 100644 --- a/test/src/models/key_list_test.dart +++ b/test/src/models/key_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = KeyList.fromMap(map); - expect(result.total, 5); - expect(result.keys, []); - }); + expect(result.total, 5); + expect(result.keys, []); + }); }); } diff --git a/test/src/models/key_test.dart b/test/src/models/key_test.dart index 2050b172..7b443385 100644 --- a/test/src/models/key_test.dart +++ b/test/src/models/key_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = Key.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My API Key'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.scopes, []); - expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.sdks, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.scopes, []); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); }); } diff --git a/test/src/models/language_list_test.dart b/test/src/models/language_list_test.dart index fd0dd58c..fe8fd5ad 100644 --- a/test/src/models/language_list_test.dart +++ b/test/src/models/language_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LanguageList.fromMap(map); - expect(result.total, 5); - expect(result.languages, []); - }); + expect(result.total, 5); + expect(result.languages, []); + }); }); } diff --git a/test/src/models/language_test.dart b/test/src/models/language_test.dart index 6db0ddbf..b8c302be 100644 --- a/test/src/models/language_test.dart +++ b/test/src/models/language_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = Language.fromMap(map); - expect(result.name, 'Italian'); - expect(result.code, 'it'); - expect(result.nativeName, 'Italiano'); - }); + expect(result.name, 'Italian'); + expect(result.code, 'it'); + expect(result.nativeName, 'Italiano'); + }); }); } diff --git a/test/src/models/locale_code_list_test.dart b/test/src/models/locale_code_list_test.dart index c086cdd1..0f1be0d2 100644 --- a/test/src/models/locale_code_list_test.dart +++ b/test/src/models/locale_code_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LocaleCodeList.fromMap(map); - expect(result.total, 5); - expect(result.localeCodes, []); - }); + expect(result.total, 5); + expect(result.localeCodes, []); + }); }); } diff --git a/test/src/models/locale_code_test.dart b/test/src/models/locale_code_test.dart index 26116578..bf3b0c2c 100644 --- a/test/src/models/locale_code_test.dart +++ b/test/src/models/locale_code_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LocaleCode.fromMap(map); - expect(result.code, 'en-us'); - expect(result.name, 'US'); - }); + expect(result.code, 'en-us'); + expect(result.name, 'US'); + }); }); } diff --git a/test/src/models/locale_test.dart b/test/src/models/locale_test.dart index 0b65d14a..3def85b0 100644 --- a/test/src/models/locale_test.dart +++ b/test/src/models/locale_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = Locale.fromMap(map); - expect(result.ip, '127.0.0.1'); - expect(result.countryCode, 'US'); - expect(result.country, 'United States'); - expect(result.continentCode, 'NA'); - expect(result.continent, 'North America'); - expect(result.eu, true); - expect(result.currency, 'USD'); - }); + expect(result.ip, '127.0.0.1'); + expect(result.countryCode, 'US'); + expect(result.country, 'United States'); + expect(result.continentCode, 'NA'); + expect(result.continent, 'North America'); + expect(result.eu, true); + expect(result.currency, 'USD'); + }); }); } diff --git a/test/src/models/log_list_test.dart b/test/src/models/log_list_test.dart index a66cdabf..c308bc58 100644 --- a/test/src/models/log_list_test.dart +++ b/test/src/models/log_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LogList.fromMap(map); - expect(result.total, 5); - expect(result.logs, []); - }); + expect(result.total, 5); + expect(result.logs, []); + }); }); } diff --git a/test/src/models/log_test.dart b/test/src/models/log_test.dart index 24273a11..ecc91978 100644 --- a/test/src/models/log_test.dart +++ b/test/src/models/log_test.dart @@ -32,28 +32,28 @@ void main() { final map = model.toMap(); final result = Log.fromMap(map); - expect(result.event, 'account.sessions.create'); - expect(result.userId, '610fc2f985ee0'); - expect(result.userEmail, 'john@appwrite.io'); - expect(result.userName, 'John Doe'); - expect(result.mode, 'admin'); - expect(result.userType, 'user'); - expect(result.ip, '127.0.0.1'); - expect(result.time, '2020-10-15T06:38:00.000+00:00'); - expect(result.osCode, 'Mac'); - expect(result.osName, 'Mac'); - expect(result.osVersion, 'Mac'); - expect(result.clientType, 'browser'); - expect(result.clientCode, 'CM'); - expect(result.clientName, 'Chrome Mobile iOS'); - expect(result.clientVersion, '84.0'); - expect(result.clientEngine, 'WebKit'); - expect(result.clientEngineVersion, '605.1.15'); - expect(result.deviceName, 'smartphone'); - expect(result.deviceBrand, 'Google'); - expect(result.deviceModel, 'Nexus 5'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - }); + expect(result.event, 'account.sessions.create'); + expect(result.userId, '610fc2f985ee0'); + expect(result.userEmail, 'john@appwrite.io'); + expect(result.userName, 'John Doe'); + expect(result.mode, 'admin'); + expect(result.userType, 'user'); + expect(result.ip, '127.0.0.1'); + expect(result.time, '2020-10-15T06:38:00.000+00:00'); + expect(result.osCode, 'Mac'); + expect(result.osName, 'Mac'); + expect(result.osVersion, 'Mac'); + expect(result.clientType, 'browser'); + expect(result.clientCode, 'CM'); + expect(result.clientName, 'Chrome Mobile iOS'); + expect(result.clientVersion, '84.0'); + expect(result.clientEngine, 'WebKit'); + expect(result.clientEngineVersion, '605.1.15'); + expect(result.deviceName, 'smartphone'); + expect(result.deviceBrand, 'Google'); + expect(result.deviceModel, 'Nexus 5'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + }); }); } diff --git a/test/src/models/membership_list_test.dart b/test/src/models/membership_list_test.dart index 0f0f0d60..dd9dab7c 100644 --- a/test/src/models/membership_list_test.dart +++ b/test/src/models/membership_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = MembershipList.fromMap(map); - expect(result.total, 5); - expect(result.memberships, []); - }); + expect(result.total, 5); + expect(result.memberships, []); + }); }); } diff --git a/test/src/models/membership_test.dart b/test/src/models/membership_test.dart index b28fcff6..3d38d8f4 100644 --- a/test/src/models/membership_test.dart +++ b/test/src/models/membership_test.dart @@ -11,6 +11,7 @@ void main() { userId: '5e5ea5c16897e', userName: 'John Doe', userEmail: 'john@appwrite.io', + userPhone: '+1 555 555 5555', teamId: '5e5ea5c16897e', teamName: 'VIP', invited: '2020-10-15T06:38:00.000+00:00', @@ -23,19 +24,20 @@ void main() { final map = model.toMap(); final result = Membership.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5ea5c16897e'); - expect(result.userName, 'John Doe'); - expect(result.userEmail, 'john@appwrite.io'); - expect(result.teamId, '5e5ea5c16897e'); - expect(result.teamName, 'VIP'); - expect(result.invited, '2020-10-15T06:38:00.000+00:00'); - expect(result.joined, '2020-10-15T06:38:00.000+00:00'); - expect(result.confirm, true); - expect(result.mfa, true); - expect(result.roles, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5ea5c16897e'); + expect(result.userName, 'John Doe'); + expect(result.userEmail, 'john@appwrite.io'); + expect(result.userPhone, '+1 555 555 5555'); + expect(result.teamId, '5e5ea5c16897e'); + expect(result.teamName, 'VIP'); + expect(result.invited, '2020-10-15T06:38:00.000+00:00'); + expect(result.joined, '2020-10-15T06:38:00.000+00:00'); + expect(result.confirm, true); + expect(result.mfa, true); + expect(result.roles, []); + }); }); } diff --git a/test/src/models/message_list_test.dart b/test/src/models/message_list_test.dart index cd22ec3a..cb972d14 100644 --- a/test/src/models/message_list_test.dart +++ b/test/src/models/message_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = MessageList.fromMap(map); - expect(result.total, 5); - expect(result.messages, []); - }); + expect(result.total, 5); + expect(result.messages, []); + }); }); } diff --git a/test/src/models/message_test.dart b/test/src/models/message_test.dart index 1ef04c69..330e09a0 100644 --- a/test/src/models/message_test.dart +++ b/test/src/models/message_test.dart @@ -21,16 +21,16 @@ void main() { final map = model.toMap(); final result = Message.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.providerType, 'email'); - expect(result.topics, []); - expect(result.users, []); - expect(result.targets, []); - expect(result.deliveredTotal, 1); - expect(result.data, {}); - expect(result.status, MessageStatus.draft); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.providerType, 'email'); + expect(result.topics, []); + expect(result.users, []); + expect(result.targets, []); + expect(result.deliveredTotal, 1); + expect(result.data, {}); + expect(result.status, MessageStatus.draft); + }); }); } diff --git a/test/src/models/mfa_challenge_test.dart b/test/src/models/mfa_challenge_test.dart index 568d6e83..e5a9e0f1 100644 --- a/test/src/models/mfa_challenge_test.dart +++ b/test/src/models/mfa_challenge_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = MfaChallenge.fromMap(map); - expect(result.$id, 'bb8ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5ea5c168bb8'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, 'bb8ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5ea5c168bb8'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/mfa_factors_test.dart b/test/src/models/mfa_factors_test.dart index 59b7e2c7..799dd80e 100644 --- a/test/src/models/mfa_factors_test.dart +++ b/test/src/models/mfa_factors_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = MfaFactors.fromMap(map); - expect(result.totp, true); - expect(result.phone, true); - expect(result.email, true); - expect(result.recoveryCode, true); - }); + expect(result.totp, true); + expect(result.phone, true); + expect(result.email, true); + expect(result.recoveryCode, true); + }); }); } diff --git a/test/src/models/mfa_recovery_codes_test.dart b/test/src/models/mfa_recovery_codes_test.dart index 36eb4701..759cb0f6 100644 --- a/test/src/models/mfa_recovery_codes_test.dart +++ b/test/src/models/mfa_recovery_codes_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = MfaRecoveryCodes.fromMap(map); - expect(result.recoveryCodes, []); - }); + expect(result.recoveryCodes, []); + }); }); } diff --git a/test/src/models/mfa_type_test.dart b/test/src/models/mfa_type_test.dart index e391105b..2e9cb251 100644 --- a/test/src/models/mfa_type_test.dart +++ b/test/src/models/mfa_type_test.dart @@ -6,16 +6,14 @@ void main() { test('model', () { final model = MfaType( secret: '[SHARED_SECRET]', - uri: - 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', + uri: 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', ); final map = model.toMap(); final result = MfaType.fromMap(map); - expect(result.secret, '[SHARED_SECRET]'); - expect(result.uri, - 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite'); - }); + expect(result.secret, '[SHARED_SECRET]'); + expect(result.uri, 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite'); + }); }); } diff --git a/test/src/models/mock_number_list_test.dart b/test/src/models/mock_number_list_test.dart new file mode 100644 index 00000000..a1b8044a --- /dev/null +++ b/test/src/models/mock_number_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('MockNumberList', () { + test('model', () { + final model = MockNumberList( + total: 5, + mockNumbers: [], + ); + + final map = model.toMap(); + final result = MockNumberList.fromMap(map); + + expect(result.total, 5); + expect(result.mockNumbers, []); + }); + }); +} diff --git a/test/src/models/mock_number_test.dart b/test/src/models/mock_number_test.dart index 9180847f..61ba8703 100644 --- a/test/src/models/mock_number_test.dart +++ b/test/src/models/mock_number_test.dart @@ -5,15 +5,19 @@ void main() { group('MockNumber', () { test('model', () { final model = MockNumber( - phone: '+1612842323', + number: '+1612842323', otp: '123456', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', ); final map = model.toMap(); final result = MockNumber.fromMap(map); - expect(result.phone, '+1612842323'); - expect(result.otp, '123456'); - }); + expect(result.number, '+1612842323'); + expect(result.otp, '123456'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/o_auth2_amazon_test.dart b/test/src/models/o_auth2_amazon_test.dart new file mode 100644 index 00000000..3c58c742 --- /dev/null +++ b/test/src/models/o_auth2_amazon_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Amazon', () { + test('model', () { + final model = OAuth2Amazon( + $id: 'github', + enabled: true, + clientId: 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + clientSecret: '79ffe4000000000000000000000000000000000000000000000000000002de55', + ); + + final map = model.toMap(); + final result = OAuth2Amazon.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2'); + expect(result.clientSecret, '79ffe4000000000000000000000000000000000000000000000000000002de55'); + }); + }); +} diff --git a/test/src/models/o_auth2_apple_test.dart b/test/src/models/o_auth2_apple_test.dart new file mode 100644 index 00000000..b3935804 --- /dev/null +++ b/test/src/models/o_auth2_apple_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Apple', () { + test('model', () { + final model = OAuth2Apple( + $id: 'apple', + enabled: true, + serviceId: 'ip.appwrite.app.web', + keyId: 'P4000000N8', + teamId: 'D4000000R6', + p8File: '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', + ); + + final map = model.toMap(); + final result = OAuth2Apple.fromMap(map); + + expect(result.$id, 'apple'); + expect(result.enabled, true); + expect(result.serviceId, 'ip.appwrite.app.web'); + expect(result.keyId, 'P4000000N8'); + expect(result.teamId, 'D4000000R6'); + expect(result.p8File, '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----'); + }); + }); +} diff --git a/test/src/models/o_auth2_auth0_test.dart b/test/src/models/o_auth2_auth0_test.dart new file mode 100644 index 00000000..3b4d9bf0 --- /dev/null +++ b/test/src/models/o_auth2_auth0_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Auth0', () { + test('model', () { + final model = OAuth2Auth0( + $id: 'github', + enabled: true, + clientId: 'OaOkIA000000000000000000005KLSYq', + clientSecret: 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + endpoint: 'example.us.auth0.com', + ); + + final map = model.toMap(); + final result = OAuth2Auth0.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'OaOkIA000000000000000000005KLSYq'); + expect(result.clientSecret, 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF'); + expect(result.endpoint, 'example.us.auth0.com'); + }); + }); +} diff --git a/test/src/models/o_auth2_authentik_test.dart b/test/src/models/o_auth2_authentik_test.dart new file mode 100644 index 00000000..0a289531 --- /dev/null +++ b/test/src/models/o_auth2_authentik_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Authentik', () { + test('model', () { + final model = OAuth2Authentik( + $id: 'github', + enabled: true, + clientId: 'dTKOPa0000000000000000000000000000e7G8hv', + clientSecret: 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + endpoint: 'example.authentik.com', + ); + + final map = model.toMap(); + final result = OAuth2Authentik.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'dTKOPa0000000000000000000000000000e7G8hv'); + expect(result.clientSecret, 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK'); + expect(result.endpoint, 'example.authentik.com'); + }); + }); +} diff --git a/test/src/models/o_auth2_autodesk_test.dart b/test/src/models/o_auth2_autodesk_test.dart new file mode 100644 index 00000000..8c540e25 --- /dev/null +++ b/test/src/models/o_auth2_autodesk_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Autodesk', () { + test('model', () { + final model = OAuth2Autodesk( + $id: 'github', + enabled: true, + clientId: '5zw90v00000000000000000000kVYXN7', + clientSecret: '7I000000000000MW', + ); + + final map = model.toMap(); + final result = OAuth2Autodesk.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '5zw90v00000000000000000000kVYXN7'); + expect(result.clientSecret, '7I000000000000MW'); + }); + }); +} diff --git a/test/src/models/o_auth2_bitbucket_test.dart b/test/src/models/o_auth2_bitbucket_test.dart new file mode 100644 index 00000000..60165e0e --- /dev/null +++ b/test/src/models/o_auth2_bitbucket_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Bitbucket', () { + test('model', () { + final model = OAuth2Bitbucket( + $id: 'github', + enabled: true, + key: 'Knt70000000000ByRc', + secret: 'NMfLZJ00000000000000000000TLQdDx', + ); + + final map = model.toMap(); + final result = OAuth2Bitbucket.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.key, 'Knt70000000000ByRc'); + expect(result.secret, 'NMfLZJ00000000000000000000TLQdDx'); + }); + }); +} diff --git a/test/src/models/o_auth2_bitly_test.dart b/test/src/models/o_auth2_bitly_test.dart new file mode 100644 index 00000000..19095762 --- /dev/null +++ b/test/src/models/o_auth2_bitly_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Bitly', () { + test('model', () { + final model = OAuth2Bitly( + $id: 'github', + enabled: true, + clientId: 'd95151000000000000000000000000000067af9b', + clientSecret: 'a13e250000000000000000000000000000d73095', + ); + + final map = model.toMap(); + final result = OAuth2Bitly.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'd95151000000000000000000000000000067af9b'); + expect(result.clientSecret, 'a13e250000000000000000000000000000d73095'); + }); + }); +} diff --git a/test/src/models/o_auth2_box_test.dart b/test/src/models/o_auth2_box_test.dart new file mode 100644 index 00000000..4f7aa2ab --- /dev/null +++ b/test/src/models/o_auth2_box_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Box', () { + test('model', () { + final model = OAuth2Box( + $id: 'github', + enabled: true, + clientId: 'deglcs00000000000000000000x2og6y', + clientSecret: 'OKM1f100000000000000000000eshEif', + ); + + final map = model.toMap(); + final result = OAuth2Box.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'deglcs00000000000000000000x2og6y'); + expect(result.clientSecret, 'OKM1f100000000000000000000eshEif'); + }); + }); +} diff --git a/test/src/models/o_auth2_dailymotion_test.dart b/test/src/models/o_auth2_dailymotion_test.dart new file mode 100644 index 00000000..838987a2 --- /dev/null +++ b/test/src/models/o_auth2_dailymotion_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Dailymotion', () { + test('model', () { + final model = OAuth2Dailymotion( + $id: 'github', + enabled: true, + apiKey: '07a9000000000000067f', + apiSecret: 'a399a90000000000000000000000000000d90639', + ); + + final map = model.toMap(); + final result = OAuth2Dailymotion.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.apiKey, '07a9000000000000067f'); + expect(result.apiSecret, 'a399a90000000000000000000000000000d90639'); + }); + }); +} diff --git a/test/src/models/o_auth2_discord_test.dart b/test/src/models/o_auth2_discord_test.dart new file mode 100644 index 00000000..c59cbc3a --- /dev/null +++ b/test/src/models/o_auth2_discord_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Discord', () { + test('model', () { + final model = OAuth2Discord( + $id: 'github', + enabled: true, + clientId: '950722000000343754', + clientSecret: 'YmPXnM000000000000000000002zFg5D', + ); + + final map = model.toMap(); + final result = OAuth2Discord.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '950722000000343754'); + expect(result.clientSecret, 'YmPXnM000000000000000000002zFg5D'); + }); + }); +} diff --git a/test/src/models/o_auth2_disqus_test.dart b/test/src/models/o_auth2_disqus_test.dart new file mode 100644 index 00000000..8d4f62b7 --- /dev/null +++ b/test/src/models/o_auth2_disqus_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Disqus', () { + test('model', () { + final model = OAuth2Disqus( + $id: 'github', + enabled: true, + publicKey: 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + secretKey: 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', + ); + + final map = model.toMap(); + final result = OAuth2Disqus.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.publicKey, 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX'); + expect(result.secretKey, 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9'); + }); + }); +} diff --git a/test/src/models/o_auth2_dropbox_test.dart b/test/src/models/o_auth2_dropbox_test.dart new file mode 100644 index 00000000..e0cf6b69 --- /dev/null +++ b/test/src/models/o_auth2_dropbox_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Dropbox', () { + test('model', () { + final model = OAuth2Dropbox( + $id: 'github', + enabled: true, + appKey: 'jl000000000009t', + appSecret: 'g200000000000vw', + ); + + final map = model.toMap(); + final result = OAuth2Dropbox.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.appKey, 'jl000000000009t'); + expect(result.appSecret, 'g200000000000vw'); + }); + }); +} diff --git a/test/src/models/o_auth2_etsy_test.dart b/test/src/models/o_auth2_etsy_test.dart new file mode 100644 index 00000000..9197710d --- /dev/null +++ b/test/src/models/o_auth2_etsy_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Etsy', () { + test('model', () { + final model = OAuth2Etsy( + $id: 'github', + enabled: true, + keyString: 'nsgzxh0000000000008j85a2', + sharedSecret: 'tp000000ru', + ); + + final map = model.toMap(); + final result = OAuth2Etsy.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.keyString, 'nsgzxh0000000000008j85a2'); + expect(result.sharedSecret, 'tp000000ru'); + }); + }); +} diff --git a/test/src/models/o_auth2_facebook_test.dart b/test/src/models/o_auth2_facebook_test.dart new file mode 100644 index 00000000..960ca133 --- /dev/null +++ b/test/src/models/o_auth2_facebook_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Facebook', () { + test('model', () { + final model = OAuth2Facebook( + $id: 'github', + enabled: true, + appId: '260600000007694', + appSecret: '2d0b2800000000000000000000d38af4', + ); + + final map = model.toMap(); + final result = OAuth2Facebook.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.appId, '260600000007694'); + expect(result.appSecret, '2d0b2800000000000000000000d38af4'); + }); + }); +} diff --git a/test/src/models/o_auth2_figma_test.dart b/test/src/models/o_auth2_figma_test.dart new file mode 100644 index 00000000..f329a826 --- /dev/null +++ b/test/src/models/o_auth2_figma_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Figma', () { + test('model', () { + final model = OAuth2Figma( + $id: 'github', + enabled: true, + clientId: 'byay5H0000000000VtiI40', + clientSecret: 'yEpOYn0000000000000000004iIsU5', + ); + + final map = model.toMap(); + final result = OAuth2Figma.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'byay5H0000000000VtiI40'); + expect(result.clientSecret, 'yEpOYn0000000000000000004iIsU5'); + }); + }); +} diff --git a/test/src/models/o_auth2_fusion_auth_test.dart b/test/src/models/o_auth2_fusion_auth_test.dart new file mode 100644 index 00000000..cf9d2bf0 --- /dev/null +++ b/test/src/models/o_auth2_fusion_auth_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2FusionAuth', () { + test('model', () { + final model = OAuth2FusionAuth( + $id: 'github', + enabled: true, + clientId: 'b2222c00-0000-0000-0000-000000862097', + clientSecret: 'Jx4s0C0000000000000000000000000000000wGqLsc', + endpoint: 'example.fusionauth.io', + ); + + final map = model.toMap(); + final result = OAuth2FusionAuth.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'b2222c00-0000-0000-0000-000000862097'); + expect(result.clientSecret, 'Jx4s0C0000000000000000000000000000000wGqLsc'); + expect(result.endpoint, 'example.fusionauth.io'); + }); + }); +} diff --git a/test/src/models/o_auth2_github_test.dart b/test/src/models/o_auth2_github_test.dart new file mode 100644 index 00000000..9ec45b19 --- /dev/null +++ b/test/src/models/o_auth2_github_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Github', () { + test('model', () { + final model = OAuth2Github( + $id: 'github', + enabled: true, + clientId: 'e4d87900000000540733', + clientSecret: '5e07c00000000000000000000000000000198bcc', + ); + + final map = model.toMap(); + final result = OAuth2Github.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'e4d87900000000540733'); + expect(result.clientSecret, '5e07c00000000000000000000000000000198bcc'); + }); + }); +} diff --git a/test/src/models/o_auth2_gitlab_test.dart b/test/src/models/o_auth2_gitlab_test.dart new file mode 100644 index 00000000..888e7c5c --- /dev/null +++ b/test/src/models/o_auth2_gitlab_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Gitlab', () { + test('model', () { + final model = OAuth2Gitlab( + $id: 'github', + enabled: true, + applicationId: 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + secret: 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + endpoint: 'https://gitlab.com', + ); + + final map = model.toMap(); + final result = OAuth2Gitlab.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.applicationId, 'd41ffe0000000000000000000000000000000000000000000000000000d5e252'); + expect(result.secret, 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38'); + expect(result.endpoint, 'https://gitlab.com'); + }); + }); +} diff --git a/test/src/models/o_auth2_google_test.dart b/test/src/models/o_auth2_google_test.dart new file mode 100644 index 00000000..a4c4470f --- /dev/null +++ b/test/src/models/o_auth2_google_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Google', () { + test('model', () { + final model = OAuth2Google( + $id: 'github', + enabled: true, + clientId: 'your-google-client-id.apps.googleusercontent.com', + clientSecret: 'your-google-client-secret', + ); + + final map = model.toMap(); + final result = OAuth2Google.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'your-google-client-id.apps.googleusercontent.com'); + expect(result.clientSecret, 'your-google-client-secret'); + }); + }); +} diff --git a/test/src/models/o_auth2_keycloak_test.dart b/test/src/models/o_auth2_keycloak_test.dart new file mode 100644 index 00000000..bb34bb09 --- /dev/null +++ b/test/src/models/o_auth2_keycloak_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Keycloak', () { + test('model', () { + final model = OAuth2Keycloak( + $id: 'github', + enabled: true, + clientId: 'appwrite-o0000000st-app', + clientSecret: 'jdjrJd00000000000000000000HUsaZO', + endpoint: 'keycloak.example.com', + realmName: 'appwrite-realm', + ); + + final map = model.toMap(); + final result = OAuth2Keycloak.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'appwrite-o0000000st-app'); + expect(result.clientSecret, 'jdjrJd00000000000000000000HUsaZO'); + expect(result.endpoint, 'keycloak.example.com'); + expect(result.realmName, 'appwrite-realm'); + }); + }); +} diff --git a/test/src/models/o_auth2_kick_test.dart b/test/src/models/o_auth2_kick_test.dart new file mode 100644 index 00000000..87103254 --- /dev/null +++ b/test/src/models/o_auth2_kick_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Kick', () { + test('model', () { + final model = OAuth2Kick( + $id: 'github', + enabled: true, + clientId: '01KQ7C00000000000001MFHS32', + clientSecret: '34ac5600000000000000000000000000000000000000000000000000e830c8b', + ); + + final map = model.toMap(); + final result = OAuth2Kick.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '01KQ7C00000000000001MFHS32'); + expect(result.clientSecret, '34ac5600000000000000000000000000000000000000000000000000e830c8b'); + }); + }); +} diff --git a/test/src/models/o_auth2_linkedin_test.dart b/test/src/models/o_auth2_linkedin_test.dart new file mode 100644 index 00000000..feb75293 --- /dev/null +++ b/test/src/models/o_auth2_linkedin_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Linkedin', () { + test('model', () { + final model = OAuth2Linkedin( + $id: 'github', + enabled: true, + clientId: '770000000000dv', + primaryClientSecret: 'your-linkedin-client-secret', + ); + + final map = model.toMap(); + final result = OAuth2Linkedin.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '770000000000dv'); + expect(result.primaryClientSecret, 'your-linkedin-client-secret'); + }); + }); +} diff --git a/test/src/models/o_auth2_microsoft_test.dart b/test/src/models/o_auth2_microsoft_test.dart new file mode 100644 index 00000000..e8f534a9 --- /dev/null +++ b/test/src/models/o_auth2_microsoft_test.dart @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Microsoft', () { + test('model', () { + final model = OAuth2Microsoft( + $id: 'github', + enabled: true, + applicationId: '00001111-aaaa-2222-bbbb-3333cccc4444', + applicationSecret: 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + tenant: 'common', + ); + + final map = model.toMap(); + final result = OAuth2Microsoft.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.applicationId, '00001111-aaaa-2222-bbbb-3333cccc4444'); + expect(result.applicationSecret, 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u'); + expect(result.tenant, 'common'); + }); + }); +} diff --git a/test/src/models/o_auth2_notion_test.dart b/test/src/models/o_auth2_notion_test.dart new file mode 100644 index 00000000..977846a1 --- /dev/null +++ b/test/src/models/o_auth2_notion_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Notion', () { + test('model', () { + final model = OAuth2Notion( + $id: 'github', + enabled: true, + oauthClientId: '341d8700-0000-0000-0000-000000446ee3', + oauthClientSecret: 'secret_dLUr4b000000000000000000000000000000lFHAa9', + ); + + final map = model.toMap(); + final result = OAuth2Notion.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.oauthClientId, '341d8700-0000-0000-0000-000000446ee3'); + expect(result.oauthClientSecret, 'secret_dLUr4b000000000000000000000000000000lFHAa9'); + }); + }); +} diff --git a/test/src/models/o_auth2_oidc_test.dart b/test/src/models/o_auth2_oidc_test.dart new file mode 100644 index 00000000..005af2f8 --- /dev/null +++ b/test/src/models/o_auth2_oidc_test.dart @@ -0,0 +1,31 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Oidc', () { + test('model', () { + final model = OAuth2Oidc( + $id: 'github', + enabled: true, + clientId: 'qibI2x0000000000000000000000000006L2YFoG', + clientSecret: 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + wellKnownURL: 'https://myoauth.com/.well-known/openid-configuration', + authorizationURL: 'https://myoauth.com/oauth2/authorize', + tokenURL: 'https://myoauth.com/oauth2/token', + userInfoURL: 'https://myoauth.com/oauth2/userinfo', + ); + + final map = model.toMap(); + final result = OAuth2Oidc.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'qibI2x0000000000000000000000000006L2YFoG'); + expect(result.clientSecret, 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV'); + expect(result.wellKnownURL, 'https://myoauth.com/.well-known/openid-configuration'); + expect(result.authorizationURL, 'https://myoauth.com/oauth2/authorize'); + expect(result.tokenURL, 'https://myoauth.com/oauth2/token'); + expect(result.userInfoURL, 'https://myoauth.com/oauth2/userinfo'); + }); + }); +} diff --git a/test/src/models/o_auth2_okta_test.dart b/test/src/models/o_auth2_okta_test.dart new file mode 100644 index 00000000..b655a138 --- /dev/null +++ b/test/src/models/o_auth2_okta_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Okta', () { + test('model', () { + final model = OAuth2Okta( + $id: 'github', + enabled: true, + clientId: '0oa00000000000000698', + clientSecret: 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + domain: 'trial-6400025.okta.com', + authorizationServerId: 'aus000000000000000h7z', + ); + + final map = model.toMap(); + final result = OAuth2Okta.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '0oa00000000000000698'); + expect(result.clientSecret, 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV'); + expect(result.domain, 'trial-6400025.okta.com'); + expect(result.authorizationServerId, 'aus000000000000000h7z'); + }); + }); +} diff --git a/test/src/models/o_auth2_paypal_test.dart b/test/src/models/o_auth2_paypal_test.dart new file mode 100644 index 00000000..34124a3a --- /dev/null +++ b/test/src/models/o_auth2_paypal_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Paypal', () { + test('model', () { + final model = OAuth2Paypal( + $id: 'github', + enabled: true, + clientId: 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + secretKey: 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + ); + + final map = model.toMap(); + final result = OAuth2Paypal.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB'); + expect(result.secretKey, 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp'); + }); + }); +} diff --git a/test/src/models/o_auth2_podio_test.dart b/test/src/models/o_auth2_podio_test.dart new file mode 100644 index 00000000..974b4426 --- /dev/null +++ b/test/src/models/o_auth2_podio_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Podio', () { + test('model', () { + final model = OAuth2Podio( + $id: 'github', + enabled: true, + clientId: 'appwrite-oauth-test-app', + clientSecret: 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', + ); + + final map = model.toMap(); + final result = OAuth2Podio.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'appwrite-oauth-test-app'); + expect(result.clientSecret, 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN'); + }); + }); +} diff --git a/test/src/models/o_auth2_provider_list_test.dart b/test/src/models/o_auth2_provider_list_test.dart new file mode 100644 index 00000000..4457a433 --- /dev/null +++ b/test/src/models/o_auth2_provider_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2ProviderList', () { + test('model', () { + final model = OAuth2ProviderList( + total: 5, + providers: [], + ); + + final map = model.toMap(); + final result = OAuth2ProviderList.fromMap(map); + + expect(result.total, 5); + expect(result.providers, []); + }); + }); +} diff --git a/test/src/models/o_auth2_salesforce_test.dart b/test/src/models/o_auth2_salesforce_test.dart new file mode 100644 index 00000000..1ebe31ee --- /dev/null +++ b/test/src/models/o_auth2_salesforce_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Salesforce', () { + test('model', () { + final model = OAuth2Salesforce( + $id: 'github', + enabled: true, + customerKey: '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + customerSecret: '3w000000000000e2', + ); + + final map = model.toMap(); + final result = OAuth2Salesforce.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.customerKey, '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq'); + expect(result.customerSecret, '3w000000000000e2'); + }); + }); +} diff --git a/test/src/models/o_auth2_slack_test.dart b/test/src/models/o_auth2_slack_test.dart new file mode 100644 index 00000000..c97e4588 --- /dev/null +++ b/test/src/models/o_auth2_slack_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Slack', () { + test('model', () { + final model = OAuth2Slack( + $id: 'github', + enabled: true, + clientId: '23000000089.15000000000023', + clientSecret: '81656000000000000000000000f3d2fd', + ); + + final map = model.toMap(); + final result = OAuth2Slack.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '23000000089.15000000000023'); + expect(result.clientSecret, '81656000000000000000000000f3d2fd'); + }); + }); +} diff --git a/test/src/models/o_auth2_spotify_test.dart b/test/src/models/o_auth2_spotify_test.dart new file mode 100644 index 00000000..98a15fd8 --- /dev/null +++ b/test/src/models/o_auth2_spotify_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Spotify', () { + test('model', () { + final model = OAuth2Spotify( + $id: 'github', + enabled: true, + clientId: '6ec271000000000000000000009beace', + clientSecret: 'db068a000000000000000000008b5b9f', + ); + + final map = model.toMap(); + final result = OAuth2Spotify.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '6ec271000000000000000000009beace'); + expect(result.clientSecret, 'db068a000000000000000000008b5b9f'); + }); + }); +} diff --git a/test/src/models/o_auth2_stripe_test.dart b/test/src/models/o_auth2_stripe_test.dart new file mode 100644 index 00000000..736ac8ce --- /dev/null +++ b/test/src/models/o_auth2_stripe_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Stripe', () { + test('model', () { + final model = OAuth2Stripe( + $id: 'github', + enabled: true, + clientId: 'ca_UKibXX0000000000000000000006byvR', + apiSecretKey: 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', + ); + + final map = model.toMap(); + final result = OAuth2Stripe.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'ca_UKibXX0000000000000000000006byvR'); + expect(result.apiSecretKey, 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp'); + }); + }); +} diff --git a/test/src/models/o_auth2_tradeshift_test.dart b/test/src/models/o_auth2_tradeshift_test.dart new file mode 100644 index 00000000..4ccfdb80 --- /dev/null +++ b/test/src/models/o_auth2_tradeshift_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Tradeshift', () { + test('model', () { + final model = OAuth2Tradeshift( + $id: 'github', + enabled: true, + oauth2ClientId: 'appwrite-test-org.appwrite-test-app', + oauth2ClientSecret: '7cb52700-0000-0000-0000-000000ca5b83', + ); + + final map = model.toMap(); + final result = OAuth2Tradeshift.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.oauth2ClientId, 'appwrite-test-org.appwrite-test-app'); + expect(result.oauth2ClientSecret, '7cb52700-0000-0000-0000-000000ca5b83'); + }); + }); +} diff --git a/test/src/models/o_auth2_twitch_test.dart b/test/src/models/o_auth2_twitch_test.dart new file mode 100644 index 00000000..b52c26d7 --- /dev/null +++ b/test/src/models/o_auth2_twitch_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Twitch', () { + test('model', () { + final model = OAuth2Twitch( + $id: 'github', + enabled: true, + clientId: 'vvi0in000000000000000000ikmt9p', + clientSecret: 'pmapue000000000000000000zylw3v', + ); + + final map = model.toMap(); + final result = OAuth2Twitch.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'vvi0in000000000000000000ikmt9p'); + expect(result.clientSecret, 'pmapue000000000000000000zylw3v'); + }); + }); +} diff --git a/test/src/models/o_auth2_word_press_test.dart b/test/src/models/o_auth2_word_press_test.dart new file mode 100644 index 00000000..c515282c --- /dev/null +++ b/test/src/models/o_auth2_word_press_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2WordPress', () { + test('model', () { + final model = OAuth2WordPress( + $id: 'github', + enabled: true, + clientId: '130005', + clientSecret: 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', + ); + + final map = model.toMap(); + final result = OAuth2WordPress.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '130005'); + expect(result.clientSecret, 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk'); + }); + }); +} diff --git a/test/src/models/o_auth2_x_test.dart b/test/src/models/o_auth2_x_test.dart new file mode 100644 index 00000000..90d5277d --- /dev/null +++ b/test/src/models/o_auth2_x_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2X', () { + test('model', () { + final model = OAuth2X( + $id: 'github', + enabled: true, + customerKey: 'slzZV0000000000000NFLaWT', + secretKey: 'tkEPkp00000000000000000000000000000000000000FTxbI9', + ); + + final map = model.toMap(); + final result = OAuth2X.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.customerKey, 'slzZV0000000000000NFLaWT'); + expect(result.secretKey, 'tkEPkp00000000000000000000000000000000000000FTxbI9'); + }); + }); +} diff --git a/test/src/models/o_auth2_yahoo_test.dart b/test/src/models/o_auth2_yahoo_test.dart new file mode 100644 index 00000000..ef9d4d82 --- /dev/null +++ b/test/src/models/o_auth2_yahoo_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Yahoo', () { + test('model', () { + final model = OAuth2Yahoo( + $id: 'github', + enabled: true, + clientId: 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + clientSecret: 'cf978f0000000000000000000000000000c5e2e9', + ); + + final map = model.toMap(); + final result = OAuth2Yahoo.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm'); + expect(result.clientSecret, 'cf978f0000000000000000000000000000c5e2e9'); + }); + }); +} diff --git a/test/src/models/o_auth2_yandex_test.dart b/test/src/models/o_auth2_yandex_test.dart new file mode 100644 index 00000000..ff501508 --- /dev/null +++ b/test/src/models/o_auth2_yandex_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Yandex', () { + test('model', () { + final model = OAuth2Yandex( + $id: 'github', + enabled: true, + clientId: '6a8a6a0000000000000000000091483c', + clientSecret: 'bbf98500000000000000000000c75a63', + ); + + final map = model.toMap(); + final result = OAuth2Yandex.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '6a8a6a0000000000000000000091483c'); + expect(result.clientSecret, 'bbf98500000000000000000000c75a63'); + }); + }); +} diff --git a/test/src/models/o_auth2_zoho_test.dart b/test/src/models/o_auth2_zoho_test.dart new file mode 100644 index 00000000..9ab6d3f8 --- /dev/null +++ b/test/src/models/o_auth2_zoho_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Zoho', () { + test('model', () { + final model = OAuth2Zoho( + $id: 'github', + enabled: true, + clientId: '1000.83C178000000000000000000RPNX0B', + clientSecret: 'fb5cac000000000000000000000000000000a68f6e', + ); + + final map = model.toMap(); + final result = OAuth2Zoho.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '1000.83C178000000000000000000RPNX0B'); + expect(result.clientSecret, 'fb5cac000000000000000000000000000000a68f6e'); + }); + }); +} diff --git a/test/src/models/o_auth2_zoom_test.dart b/test/src/models/o_auth2_zoom_test.dart new file mode 100644 index 00000000..d3a0f43e --- /dev/null +++ b/test/src/models/o_auth2_zoom_test.dart @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('OAuth2Zoom', () { + test('model', () { + final model = OAuth2Zoom( + $id: 'github', + enabled: true, + clientId: 'QMAC00000000000000w0AQ', + clientSecret: 'GAWsG4000000000000000000007U01ON', + ); + + final map = model.toMap(); + final result = OAuth2Zoom.fromMap(map); + + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'QMAC00000000000000w0AQ'); + expect(result.clientSecret, 'GAWsG4000000000000000000007U01ON'); + }); + }); +} diff --git a/test/src/models/phone_list_test.dart b/test/src/models/phone_list_test.dart index 6b5ff57e..63e07b8c 100644 --- a/test/src/models/phone_list_test.dart +++ b/test/src/models/phone_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PhoneList.fromMap(map); - expect(result.total, 5); - expect(result.phones, []); - }); + expect(result.total, 5); + expect(result.phones, []); + }); }); } diff --git a/test/src/models/phone_test.dart b/test/src/models/phone_test.dart index 03ba35f6..e65d3c59 100644 --- a/test/src/models/phone_test.dart +++ b/test/src/models/phone_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = Phone.fromMap(map); - expect(result.code, '+1'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - }); + expect(result.code, '+1'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + }); }); } diff --git a/test/src/models/platform_android_test.dart b/test/src/models/platform_android_test.dart index 67f712fc..1d77a094 100644 --- a/test/src/models/platform_android_test.dart +++ b/test/src/models/platform_android_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformAndroid.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.applicationId, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.applicationId, 'com.company.appname'); + }); }); } diff --git a/test/src/models/platform_apple_test.dart b/test/src/models/platform_apple_test.dart index 0c238f4e..88242f44 100644 --- a/test/src/models/platform_apple_test.dart +++ b/test/src/models/platform_apple_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformApple.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.bundleIdentifier, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.bundleIdentifier, 'com.company.appname'); + }); }); } diff --git a/test/src/models/platform_linux_test.dart b/test/src/models/platform_linux_test.dart index a28a0658..64273f49 100644 --- a/test/src/models/platform_linux_test.dart +++ b/test/src/models/platform_linux_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformLinux.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.packageName, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.packageName, 'com.company.appname'); + }); }); } diff --git a/test/src/models/platform_list_test.dart b/test/src/models/platform_list_test.dart index 6661761d..0e3a9188 100644 --- a/test/src/models/platform_list_test.dart +++ b/test/src/models/platform_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PlatformList.fromMap(map); - expect(result.total, 5); - expect(result.platforms, []); - }); + expect(result.total, 5); + expect(result.platforms, []); + }); }); } diff --git a/test/src/models/platform_web_test.dart b/test/src/models/platform_web_test.dart index 29dc32e8..84673233 100644 --- a/test/src/models/platform_web_test.dart +++ b/test/src/models/platform_web_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformWeb.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.hostname, 'app.example.com'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.hostname, 'app.example.com'); + }); }); } diff --git a/test/src/models/platform_windows_test.dart b/test/src/models/platform_windows_test.dart index 57c708f9..76808780 100644 --- a/test/src/models/platform_windows_test.dart +++ b/test/src/models/platform_windows_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformWindows.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.packageIdentifierName, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.packageIdentifierName, 'com.company.appname'); + }); }); } diff --git a/test/src/models/policy_list_test.dart b/test/src/models/policy_list_test.dart new file mode 100644 index 00000000..ce810910 --- /dev/null +++ b/test/src/models/policy_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyList', () { + test('model', () { + final model = PolicyList( + total: 9, + policies: [], + ); + + final map = model.toMap(); + final result = PolicyList.fromMap(map); + + expect(result.total, 9); + expect(result.policies, []); + }); + }); +} diff --git a/test/src/models/policy_membership_privacy_test.dart b/test/src/models/policy_membership_privacy_test.dart new file mode 100644 index 00000000..bb9b280e --- /dev/null +++ b/test/src/models/policy_membership_privacy_test.dart @@ -0,0 +1,27 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyMembershipPrivacy', () { + test('model', () { + final model = PolicyMembershipPrivacy( + $id: 'password-dictionary', + userId: true, + userEmail: true, + userPhone: true, + userName: true, + userMFA: true, + ); + + final map = model.toMap(); + final result = PolicyMembershipPrivacy.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.userId, true); + expect(result.userEmail, true); + expect(result.userPhone, true); + expect(result.userName, true); + expect(result.userMFA, true); + }); + }); +} diff --git a/test/src/models/policy_password_dictionary_test.dart b/test/src/models/policy_password_dictionary_test.dart new file mode 100644 index 00000000..9ecb5c55 --- /dev/null +++ b/test/src/models/policy_password_dictionary_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyPasswordDictionary', () { + test('model', () { + final model = PolicyPasswordDictionary( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicyPasswordDictionary.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_password_history_test.dart b/test/src/models/policy_password_history_test.dart new file mode 100644 index 00000000..56f2a4bc --- /dev/null +++ b/test/src/models/policy_password_history_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyPasswordHistory', () { + test('model', () { + final model = PolicyPasswordHistory( + $id: 'password-dictionary', + total: 5, + ); + + final map = model.toMap(); + final result = PolicyPasswordHistory.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.total, 5); + }); + }); +} diff --git a/test/src/models/policy_password_personal_data_test.dart b/test/src/models/policy_password_personal_data_test.dart new file mode 100644 index 00000000..767ccd86 --- /dev/null +++ b/test/src/models/policy_password_personal_data_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyPasswordPersonalData', () { + test('model', () { + final model = PolicyPasswordPersonalData( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicyPasswordPersonalData.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_session_alert_test.dart b/test/src/models/policy_session_alert_test.dart new file mode 100644 index 00000000..3991797c --- /dev/null +++ b/test/src/models/policy_session_alert_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionAlert', () { + test('model', () { + final model = PolicySessionAlert( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicySessionAlert.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_session_duration_test.dart b/test/src/models/policy_session_duration_test.dart new file mode 100644 index 00000000..2b0628ce --- /dev/null +++ b/test/src/models/policy_session_duration_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionDuration', () { + test('model', () { + final model = PolicySessionDuration( + $id: 'password-dictionary', + duration: 3600, + ); + + final map = model.toMap(); + final result = PolicySessionDuration.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.duration, 3600); + }); + }); +} diff --git a/test/src/models/policy_session_invalidation_test.dart b/test/src/models/policy_session_invalidation_test.dart new file mode 100644 index 00000000..d0fb3bfc --- /dev/null +++ b/test/src/models/policy_session_invalidation_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionInvalidation', () { + test('model', () { + final model = PolicySessionInvalidation( + $id: 'password-dictionary', + enabled: true, + ); + + final map = model.toMap(); + final result = PolicySessionInvalidation.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); + }); +} diff --git a/test/src/models/policy_session_limit_test.dart b/test/src/models/policy_session_limit_test.dart new file mode 100644 index 00000000..5a4d7786 --- /dev/null +++ b/test/src/models/policy_session_limit_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicySessionLimit', () { + test('model', () { + final model = PolicySessionLimit( + $id: 'password-dictionary', + total: 10, + ); + + final map = model.toMap(); + final result = PolicySessionLimit.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.total, 10); + }); + }); +} diff --git a/test/src/models/policy_user_limit_test.dart b/test/src/models/policy_user_limit_test.dart new file mode 100644 index 00000000..93ace965 --- /dev/null +++ b/test/src/models/policy_user_limit_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PolicyUserLimit', () { + test('model', () { + final model = PolicyUserLimit( + $id: 'password-dictionary', + total: 100, + ); + + final map = model.toMap(); + final result = PolicyUserLimit.fromMap(map); + + expect(result.$id, 'password-dictionary'); + expect(result.total, 100); + }); + }); +} diff --git a/test/src/models/preferences_test.dart b/test/src/models/preferences_test.dart index 8711977f..7f0e6ba0 100644 --- a/test/src/models/preferences_test.dart +++ b/test/src/models/preferences_test.dart @@ -10,6 +10,7 @@ void main() { final map = model.toMap(); final result = Preferences.fromMap(map); + }); }); } diff --git a/test/src/models/presence_list_test.dart b/test/src/models/presence_list_test.dart new file mode 100644 index 00000000..c88aba0b --- /dev/null +++ b/test/src/models/presence_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('PresenceList', () { + test('model', () { + final model = PresenceList( + total: 5, + presences: [], + ); + + final map = model.toMap(); + final result = PresenceList.fromMap(map); + + expect(result.total, 5); + expect(result.presences, []); + }); + }); +} diff --git a/test/src/models/presence_test.dart b/test/src/models/presence_test.dart new file mode 100644 index 00000000..1cffd434 --- /dev/null +++ b/test/src/models/presence_test.dart @@ -0,0 +1,32 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('Presence', () { + test('model', () { + final model = Presence( + $id: '5e5ea5c16897e', + $sequence: '1', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + $permissions: [], + userInternalId: '1', + userId: '674af8f3e12a5f9ac0be', + source: 'HTTP', + data: {}, + ); + + final map = model.toMap(); + final result = Presence.fromMap(map); + + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.userInternalId, '1'); + expect(result.userId, '674af8f3e12a5f9ac0be'); + expect(result.source, 'HTTP'); + }); + }); +} diff --git a/test/src/models/project_test.dart b/test/src/models/project_test.dart index adf8ccbe..02886f07 100644 --- a/test/src/models/project_test.dart +++ b/test/src/models/project_test.dart @@ -33,6 +33,8 @@ void main() { authMembershipsUserName: true, authMembershipsUserEmail: true, authMembershipsMfa: true, + authMembershipsUserId: true, + authMembershipsUserPhone: true, authInvalidateSessions: true, oAuthProviders: [], platforms: [], @@ -42,11 +44,12 @@ void main() { smtpEnabled: true, smtpSenderName: 'John Appwrite', smtpSenderEmail: 'john@appwrite.io', - smtpReplyTo: 'support@appwrite.io', + smtpReplyToName: 'Support Team', + smtpReplyToEmail: 'support@appwrite.io', smtpHost: 'mail.appwrite.io', smtpPort: 25, smtpUsername: 'emailuser', - smtpPassword: 'securepassword', + smtpPassword: '', smtpSecure: 'tls', pingCount: 1, pingedAt: '2020-10-15T06:38:00.000+00:00', @@ -81,15 +84,15 @@ void main() { protocolStatusForWebsocket: true, region: 'fra', billingLimits: BillingLimits( - bandwidth: 5, - storage: 150, - users: 200000, - executions: 750000, - GBHours: 100, - imageTransformations: 100, - authPhone: 10, - budgetLimit: 100, - ), + bandwidth: 5, + storage: 150, + users: 200000, + executions: 750000, + GBHours: 100, + imageTransformations: 100, + authPhone: 10, + budgetLimit: 100, + ), blocks: [], consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', ); @@ -97,83 +100,86 @@ void main() { final map = model.toMap(); final result = Project.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'New Project'); - expect(result.description, 'This is a new project.'); - expect(result.teamId, '1592981250'); - expect(result.logo, '5f5c451b403cb'); - expect(result.url, '5f5c451b403cb'); - expect(result.legalName, 'Company LTD.'); - expect(result.legalCountry, 'US'); - expect(result.legalState, 'New York'); - expect(result.legalCity, 'New York City.'); - expect(result.legalAddress, '620 Eighth Avenue, New York, NY 10018'); - expect(result.legalTaxId, '131102020'); - expect(result.authDuration, 60); - expect(result.authLimit, 100); - expect(result.authSessionsLimit, 10); - expect(result.authPasswordHistory, 5); - expect(result.authPasswordDictionary, true); - expect(result.authPersonalDataCheck, true); - expect(result.authDisposableEmails, true); - expect(result.authCanonicalEmails, true); - expect(result.authFreeEmails, true); - expect(result.authMockNumbers, []); - expect(result.authSessionAlerts, true); - expect(result.authMembershipsUserName, true); - expect(result.authMembershipsUserEmail, true); - expect(result.authMembershipsMfa, true); - expect(result.authInvalidateSessions, true); - expect(result.oAuthProviders, []); - expect(result.platforms, []); - expect(result.webhooks, []); - expect(result.keys, []); - expect(result.devKeys, []); - expect(result.smtpEnabled, true); - expect(result.smtpSenderName, 'John Appwrite'); - expect(result.smtpSenderEmail, 'john@appwrite.io'); - expect(result.smtpReplyTo, 'support@appwrite.io'); - expect(result.smtpHost, 'mail.appwrite.io'); - expect(result.smtpPort, 25); - expect(result.smtpUsername, 'emailuser'); - expect(result.smtpPassword, 'securepassword'); - expect(result.smtpSecure, 'tls'); - expect(result.pingCount, 1); - expect(result.pingedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.labels, []); - expect(result.status, 'active'); - expect(result.authEmailPassword, true); - expect(result.authUsersAuthMagicURL, true); - expect(result.authEmailOtp, true); - expect(result.authAnonymous, true); - expect(result.authInvites, true); - expect(result.authJWT, true); - expect(result.authPhone, true); - expect(result.serviceStatusForAccount, true); - expect(result.serviceStatusForAvatars, true); - expect(result.serviceStatusForDatabases, true); - expect(result.serviceStatusForTablesdb, true); - expect(result.serviceStatusForLocale, true); - expect(result.serviceStatusForHealth, true); - expect(result.serviceStatusForProject, true); - expect(result.serviceStatusForStorage, true); - expect(result.serviceStatusForTeams, true); - expect(result.serviceStatusForUsers, true); - expect(result.serviceStatusForVcs, true); - expect(result.serviceStatusForSites, true); - expect(result.serviceStatusForFunctions, true); - expect(result.serviceStatusForProxy, true); - expect(result.serviceStatusForGraphql, true); - expect(result.serviceStatusForMigrations, true); - expect(result.serviceStatusForMessaging, true); - expect(result.protocolStatusForRest, true); - expect(result.protocolStatusForGraphql, true); - expect(result.protocolStatusForWebsocket, true); - expect(result.region, 'fra'); - expect(result.blocks, []); - expect(result.consoleAccessedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'New Project'); + expect(result.description, 'This is a new project.'); + expect(result.teamId, '1592981250'); + expect(result.logo, '5f5c451b403cb'); + expect(result.url, '5f5c451b403cb'); + expect(result.legalName, 'Company LTD.'); + expect(result.legalCountry, 'US'); + expect(result.legalState, 'New York'); + expect(result.legalCity, 'New York City.'); + expect(result.legalAddress, '620 Eighth Avenue, New York, NY 10018'); + expect(result.legalTaxId, '131102020'); + expect(result.authDuration, 60); + expect(result.authLimit, 100); + expect(result.authSessionsLimit, 10); + expect(result.authPasswordHistory, 5); + expect(result.authPasswordDictionary, true); + expect(result.authPersonalDataCheck, true); + expect(result.authDisposableEmails, true); + expect(result.authCanonicalEmails, true); + expect(result.authFreeEmails, true); + expect(result.authMockNumbers, []); + expect(result.authSessionAlerts, true); + expect(result.authMembershipsUserName, true); + expect(result.authMembershipsUserEmail, true); + expect(result.authMembershipsMfa, true); + expect(result.authMembershipsUserId, true); + expect(result.authMembershipsUserPhone, true); + expect(result.authInvalidateSessions, true); + expect(result.oAuthProviders, []); + expect(result.platforms, []); + expect(result.webhooks, []); + expect(result.keys, []); + expect(result.devKeys, []); + expect(result.smtpEnabled, true); + expect(result.smtpSenderName, 'John Appwrite'); + expect(result.smtpSenderEmail, 'john@appwrite.io'); + expect(result.smtpReplyToName, 'Support Team'); + expect(result.smtpReplyToEmail, 'support@appwrite.io'); + expect(result.smtpHost, 'mail.appwrite.io'); + expect(result.smtpPort, 25); + expect(result.smtpUsername, 'emailuser'); + expect(result.smtpPassword, ''); + expect(result.smtpSecure, 'tls'); + expect(result.pingCount, 1); + expect(result.pingedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.labels, []); + expect(result.status, 'active'); + expect(result.authEmailPassword, true); + expect(result.authUsersAuthMagicURL, true); + expect(result.authEmailOtp, true); + expect(result.authAnonymous, true); + expect(result.authInvites, true); + expect(result.authJWT, true); + expect(result.authPhone, true); + expect(result.serviceStatusForAccount, true); + expect(result.serviceStatusForAvatars, true); + expect(result.serviceStatusForDatabases, true); + expect(result.serviceStatusForTablesdb, true); + expect(result.serviceStatusForLocale, true); + expect(result.serviceStatusForHealth, true); + expect(result.serviceStatusForProject, true); + expect(result.serviceStatusForStorage, true); + expect(result.serviceStatusForTeams, true); + expect(result.serviceStatusForUsers, true); + expect(result.serviceStatusForVcs, true); + expect(result.serviceStatusForSites, true); + expect(result.serviceStatusForFunctions, true); + expect(result.serviceStatusForProxy, true); + expect(result.serviceStatusForGraphql, true); + expect(result.serviceStatusForMigrations, true); + expect(result.serviceStatusForMessaging, true); + expect(result.protocolStatusForRest, true); + expect(result.protocolStatusForGraphql, true); + expect(result.protocolStatusForWebsocket, true); + expect(result.region, 'fra'); + expect(result.blocks, []); + expect(result.consoleAccessedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/provider_list_test.dart b/test/src/models/provider_list_test.dart index 8100c9dc..22860b71 100644 --- a/test/src/models/provider_list_test.dart +++ b/test/src/models/provider_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ProviderList.fromMap(map); - expect(result.total, 5); - expect(result.providers, []); - }); + expect(result.total, 5); + expect(result.providers, []); + }); }); } diff --git a/test/src/models/provider_test.dart b/test/src/models/provider_test.dart index d3b1a8ab..e1e5a13f 100644 --- a/test/src/models/provider_test.dart +++ b/test/src/models/provider_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Provider.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'Mailgun'); - expect(result.provider, 'mailgun'); - expect(result.enabled, true); - expect(result.type, 'sms'); - expect(result.credentials, {}); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'Mailgun'); + expect(result.provider, 'mailgun'); + expect(result.enabled, true); + expect(result.type, 'sms'); + expect(result.credentials, {}); + }); }); } diff --git a/test/src/models/proxy_rule_list_test.dart b/test/src/models/proxy_rule_list_test.dart new file mode 100644 index 00000000..a6d17472 --- /dev/null +++ b/test/src/models/proxy_rule_list_test.dart @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:test/test.dart'; + +void main() { + group('ProxyRuleList', () { + test('model', () { + final model = ProxyRuleList( + total: 5, + rules: [], + ); + + final map = model.toMap(); + final result = ProxyRuleList.fromMap(map); + + expect(result.total, 5); + expect(result.rules, []); + }); + }); +} diff --git a/test/src/models/proxy_rule_test.dart b/test/src/models/proxy_rule_test.dart new file mode 100644 index 00000000..da848191 --- /dev/null +++ b/test/src/models/proxy_rule_test.dart @@ -0,0 +1,44 @@ +import 'package:dart_appwrite/models.dart'; +import 'package:dart_appwrite/enums.dart'; +import 'package:test/test.dart'; + +void main() { + group('ProxyRule', () { + test('model', () { + final model = ProxyRule( + $id: '5e5ea5c16897e', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + domain: 'appwrite.company.com', + type: 'deployment', + trigger: 'manual', + redirectUrl: 'https://appwrite.io/docs', + redirectStatusCode: 301, + deploymentId: 'n3u9feiwmf', + deploymentResourceId: 'n3u9feiwmf', + deploymentVcsProviderBranch: 'main', + status: ProxyRuleStatus.unverified, + logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + renewAt: 'datetime', + ); + + final map = model.toMap(); + final result = ProxyRule.fromMap(map); + + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.domain, 'appwrite.company.com'); + expect(result.type, 'deployment'); + expect(result.trigger, 'manual'); + expect(result.redirectUrl, 'https://appwrite.io/docs'); + expect(result.redirectStatusCode, 301); + expect(result.deploymentId, 'n3u9feiwmf'); + expect(result.deploymentResourceId, 'n3u9feiwmf'); + expect(result.deploymentVcsProviderBranch, 'main'); + expect(result.status, ProxyRuleStatus.unverified); + expect(result.logs, 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.'); + expect(result.renewAt, 'datetime'); + }); + }); +} diff --git a/test/src/models/resource_token_list_test.dart b/test/src/models/resource_token_list_test.dart index 1cda3569..f087996a 100644 --- a/test/src/models/resource_token_list_test.dart +++ b/test/src/models/resource_token_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ResourceTokenList.fromMap(map); - expect(result.total, 5); - expect(result.tokens, []); - }); + expect(result.total, 5); + expect(result.tokens, []); + }); }); } diff --git a/test/src/models/resource_token_test.dart b/test/src/models/resource_token_test.dart index bb6dfbc0..e8f7bd34 100644 --- a/test/src/models/resource_token_test.dart +++ b/test/src/models/resource_token_test.dart @@ -10,22 +10,20 @@ void main() { resourceId: '5e5ea5c168bb8:5e5ea5c168bb8', resourceType: 'files', expire: '2020-10-15T06:38:00.000+00:00', - secret: - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + secret: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', accessedAt: '2020-10-15T06:38:00.000+00:00', ); final map = model.toMap(); final result = ResourceToken.fromMap(map); - expect(result.$id, 'bb8ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.resourceId, '5e5ea5c168bb8:5e5ea5c168bb8'); - expect(result.resourceType, 'files'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.secret, - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, 'bb8ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.resourceId, '5e5ea5c168bb8:5e5ea5c168bb8'); + expect(result.resourceType, 'files'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.secret, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/row_list_test.dart b/test/src/models/row_list_test.dart index ce334d8b..b803a52f 100644 --- a/test/src/models/row_list_test.dart +++ b/test/src/models/row_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = RowList.fromMap(map); - expect(result.total, 5); - expect(result.rows, []); - }); + expect(result.total, 5); + expect(result.rows, []); + }); }); } diff --git a/test/src/models/row_test.dart b/test/src/models/row_test.dart index 5d81c348..bc1860b6 100644 --- a/test/src/models/row_test.dart +++ b/test/src/models/row_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = Row.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$sequence, '1'); - expect(result.$tableId, '5e5ea5c15117e'); - expect(result.$databaseId, '5e5ea5c15117e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$tableId, '5e5ea5c15117e'); + expect(result.$databaseId, '5e5ea5c15117e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + }); }); } diff --git a/test/src/models/runtime_list_test.dart b/test/src/models/runtime_list_test.dart index 59f6f94d..020b8f17 100644 --- a/test/src/models/runtime_list_test.dart +++ b/test/src/models/runtime_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = RuntimeList.fromMap(map); - expect(result.total, 5); - expect(result.runtimes, []); - }); + expect(result.total, 5); + expect(result.runtimes, []); + }); }); } diff --git a/test/src/models/runtime_test.dart b/test/src/models/runtime_test.dart index 225c368b..c2a070dd 100644 --- a/test/src/models/runtime_test.dart +++ b/test/src/models/runtime_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Runtime.fromMap(map); - expect(result.$id, 'python-3.8'); - expect(result.key, 'python'); - expect(result.name, 'Python'); - expect(result.version, '3.8'); - expect(result.base, 'python:3.8-alpine'); - expect(result.image, 'appwrite\\/runtime-for-python:3.8'); - expect(result.logo, 'python.png'); - expect(result.supports, []); - }); + expect(result.$id, 'python-3.8'); + expect(result.key, 'python'); + expect(result.name, 'Python'); + expect(result.version, '3.8'); + expect(result.base, 'python:3.8-alpine'); + expect(result.image, 'appwrite\\/runtime-for-python:3.8'); + expect(result.logo, 'python.png'); + expect(result.supports, []); + }); }); } diff --git a/test/src/models/session_list_test.dart b/test/src/models/session_list_test.dart index b7bc83cc..5d675fd9 100644 --- a/test/src/models/session_list_test.dart +++ b/test/src/models/session_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SessionList.fromMap(map); - expect(result.total, 5); - expect(result.sessions, []); - }); + expect(result.total, 5); + expect(result.sessions, []); + }); }); } diff --git a/test/src/models/session_test.dart b/test/src/models/session_test.dart index adda7c0d..a52c9cf0 100644 --- a/test/src/models/session_test.dart +++ b/test/src/models/session_test.dart @@ -39,35 +39,35 @@ void main() { final map = model.toMap(); final result = Session.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5bb8c16897e'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.provider, 'email'); - expect(result.providerUid, 'user@example.com'); - expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); - expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - expect(result.ip, '127.0.0.1'); - expect(result.osCode, 'Mac'); - expect(result.osName, 'Mac'); - expect(result.osVersion, 'Mac'); - expect(result.clientType, 'browser'); - expect(result.clientCode, 'CM'); - expect(result.clientName, 'Chrome Mobile iOS'); - expect(result.clientVersion, '84.0'); - expect(result.clientEngine, 'WebKit'); - expect(result.clientEngineVersion, '605.1.15'); - expect(result.deviceName, 'smartphone'); - expect(result.deviceBrand, 'Google'); - expect(result.deviceModel, 'Nexus 5'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - expect(result.current, true); - expect(result.factors, []); - expect(result.secret, '5e5bb8c16897e'); - expect(result.mfaUpdatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5bb8c16897e'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.provider, 'email'); + expect(result.providerUid, 'user@example.com'); + expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); + expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + expect(result.ip, '127.0.0.1'); + expect(result.osCode, 'Mac'); + expect(result.osName, 'Mac'); + expect(result.osVersion, 'Mac'); + expect(result.clientType, 'browser'); + expect(result.clientCode, 'CM'); + expect(result.clientName, 'Chrome Mobile iOS'); + expect(result.clientVersion, '84.0'); + expect(result.clientEngine, 'WebKit'); + expect(result.clientEngineVersion, '605.1.15'); + expect(result.deviceName, 'smartphone'); + expect(result.deviceBrand, 'Google'); + expect(result.deviceModel, 'Nexus 5'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + expect(result.current, true); + expect(result.factors, []); + expect(result.secret, '5e5bb8c16897e'); + expect(result.mfaUpdatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/site_list_test.dart b/test/src/models/site_list_test.dart index 4bfbbcb8..288619b8 100644 --- a/test/src/models/site_list_test.dart +++ b/test/src/models/site_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SiteList.fromMap(map); - expect(result.total, 5); - expect(result.sites, []); - }); + expect(result.total, 5); + expect(result.sites, []); + }); }); } diff --git a/test/src/models/site_test.dart b/test/src/models/site_test.dart index 6d97b6f2..7000c91b 100644 --- a/test/src/models/site_test.dart +++ b/test/src/models/site_test.dart @@ -42,38 +42,38 @@ void main() { final map = model.toMap(); final result = Site.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Site'); - expect(result.enabled, true); - expect(result.live, true); - expect(result.logging, true); - expect(result.framework, 'react'); - expect(result.deploymentRetention, 7); - expect(result.deploymentId, '5e5ea5c16897e'); - expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.deploymentScreenshotLight, '5e5ea5c16897e'); - expect(result.deploymentScreenshotDark, '5e5ea5c16897e'); - expect(result.latestDeploymentId, '5e5ea5c16897e'); - expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.latestDeploymentStatus, 'ready'); - expect(result.vars, []); - expect(result.timeout, 300); - expect(result.installCommand, 'npm install'); - expect(result.buildCommand, 'npm run build'); - expect(result.startCommand, 'node custom-server.mjs'); - expect(result.outputDirectory, 'build'); - expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); - expect(result.providerRepositoryId, 'appwrite'); - expect(result.providerBranch, 'main'); - expect(result.providerRootDirectory, 'sites/helloWorld'); - expect(result.providerSilentMode, true); - expect(result.buildSpecification, 's-1vcpu-512mb'); - expect(result.runtimeSpecification, 's-1vcpu-512mb'); - expect(result.buildRuntime, 'node-22'); - expect(result.adapter, 'static'); - expect(result.fallbackFile, 'index.html'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Site'); + expect(result.enabled, true); + expect(result.live, true); + expect(result.logging, true); + expect(result.framework, 'react'); + expect(result.deploymentRetention, 7); + expect(result.deploymentId, '5e5ea5c16897e'); + expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.deploymentScreenshotLight, '5e5ea5c16897e'); + expect(result.deploymentScreenshotDark, '5e5ea5c16897e'); + expect(result.latestDeploymentId, '5e5ea5c16897e'); + expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.latestDeploymentStatus, 'ready'); + expect(result.vars, []); + expect(result.timeout, 300); + expect(result.installCommand, 'npm install'); + expect(result.buildCommand, 'npm run build'); + expect(result.startCommand, 'node custom-server.mjs'); + expect(result.outputDirectory, 'build'); + expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); + expect(result.providerRepositoryId, 'appwrite'); + expect(result.providerBranch, 'main'); + expect(result.providerRootDirectory, 'sites/helloWorld'); + expect(result.providerSilentMode, true); + expect(result.buildSpecification, 's-1vcpu-512mb'); + expect(result.runtimeSpecification, 's-1vcpu-512mb'); + expect(result.buildRuntime, 'node-22'); + expect(result.adapter, 'static'); + expect(result.fallbackFile, 'index.html'); + }); }); } diff --git a/test/src/models/specification_list_test.dart b/test/src/models/specification_list_test.dart index 569f8cab..7e2f821d 100644 --- a/test/src/models/specification_list_test.dart +++ b/test/src/models/specification_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SpecificationList.fromMap(map); - expect(result.total, 5); - expect(result.specifications, []); - }); + expect(result.total, 5); + expect(result.specifications, []); + }); }); } diff --git a/test/src/models/specification_test.dart b/test/src/models/specification_test.dart index a174559f..b61ff9e4 100644 --- a/test/src/models/specification_test.dart +++ b/test/src/models/specification_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = Specification.fromMap(map); - expect(result.memory, 512); - expect(result.cpus, 1); - expect(result.enabled, true); - expect(result.slug, 's-1vcpu-512mb'); - }); + expect(result.memory, 512); + expect(result.cpus, 1); + expect(result.enabled, true); + expect(result.slug, 's-1vcpu-512mb'); + }); }); } diff --git a/test/src/models/subscriber_list_test.dart b/test/src/models/subscriber_list_test.dart index 2ef39800..401a785e 100644 --- a/test/src/models/subscriber_list_test.dart +++ b/test/src/models/subscriber_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SubscriberList.fromMap(map); - expect(result.total, 5); - expect(result.subscribers, []); - }); + expect(result.total, 5); + expect(result.subscribers, []); + }); }); } diff --git a/test/src/models/subscriber_test.dart b/test/src/models/subscriber_test.dart index ee6ac198..32d1f9e1 100644 --- a/test/src/models/subscriber_test.dart +++ b/test/src/models/subscriber_test.dart @@ -10,15 +10,15 @@ void main() { $updatedAt: '2020-10-15T06:38:00.000+00:00', targetId: '259125845563242502', target: Target( - $id: '259125845563242502', - $createdAt: '2020-10-15T06:38:00.000+00:00', - $updatedAt: '2020-10-15T06:38:00.000+00:00', - name: 'Apple iPhone 12', - userId: '259125845563242502', - providerType: 'email', - identifier: 'token', - expired: true, - ), + $id: '259125845563242502', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + name: 'Apple iPhone 12', + userId: '259125845563242502', + providerType: 'email', + identifier: 'token', + expired: true, + ), userId: '5e5ea5c16897e', userName: 'Aegon Targaryen', topicId: '259125845563242502', @@ -28,14 +28,14 @@ void main() { final map = model.toMap(); final result = Subscriber.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.targetId, '259125845563242502'); - expect(result.userId, '5e5ea5c16897e'); - expect(result.userName, 'Aegon Targaryen'); - expect(result.topicId, '259125845563242502'); - expect(result.providerType, 'email'); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.targetId, '259125845563242502'); + expect(result.userId, '5e5ea5c16897e'); + expect(result.userName, 'Aegon Targaryen'); + expect(result.topicId, '259125845563242502'); + expect(result.providerType, 'email'); + }); }); } diff --git a/test/src/models/table_list_test.dart b/test/src/models/table_list_test.dart index 1330ab89..f06d5fc6 100644 --- a/test/src/models/table_list_test.dart +++ b/test/src/models/table_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TableList.fromMap(map); - expect(result.total, 5); - expect(result.tables, []); - }); + expect(result.total, 5); + expect(result.tables, []); + }); }); } diff --git a/test/src/models/table_test.dart b/test/src/models/table_test.dart index 0919800d..f6b94ecf 100644 --- a/test/src/models/table_test.dart +++ b/test/src/models/table_test.dart @@ -22,18 +22,18 @@ void main() { final map = model.toMap(); final result = Table.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.databaseId, '5e5ea5c16897e'); - expect(result.name, 'My Table'); - expect(result.enabled, true); - expect(result.rowSecurity, true); - expect(result.columns, []); - expect(result.indexes, []); - expect(result.bytesMax, 65535); - expect(result.bytesUsed, 1500); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.databaseId, '5e5ea5c16897e'); + expect(result.name, 'My Table'); + expect(result.enabled, true); + expect(result.rowSecurity, true); + expect(result.columns, []); + expect(result.indexes, []); + expect(result.bytesMax, 65535); + expect(result.bytesUsed, 1500); + }); }); } diff --git a/test/src/models/target_list_test.dart b/test/src/models/target_list_test.dart index 7920cc85..0db975ff 100644 --- a/test/src/models/target_list_test.dart +++ b/test/src/models/target_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TargetList.fromMap(map); - expect(result.total, 5); - expect(result.targets, []); - }); + expect(result.total, 5); + expect(result.targets, []); + }); }); } diff --git a/test/src/models/target_test.dart b/test/src/models/target_test.dart index 655a840c..6f864758 100644 --- a/test/src/models/target_test.dart +++ b/test/src/models/target_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Target.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'Apple iPhone 12'); - expect(result.userId, '259125845563242502'); - expect(result.providerType, 'email'); - expect(result.identifier, 'token'); - expect(result.expired, true); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'Apple iPhone 12'); + expect(result.userId, '259125845563242502'); + expect(result.providerType, 'email'); + expect(result.identifier, 'token'); + expect(result.expired, true); + }); }); } diff --git a/test/src/models/team_list_test.dart b/test/src/models/team_list_test.dart index 875bd1af..f358a3c9 100644 --- a/test/src/models/team_list_test.dart +++ b/test/src/models/team_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TeamList.fromMap(map); - expect(result.total, 5); - expect(result.teams, []); - }); + expect(result.total, 5); + expect(result.teams, []); + }); }); } diff --git a/test/src/models/team_test.dart b/test/src/models/team_test.dart index 59eb9701..6285fe54 100644 --- a/test/src/models/team_test.dart +++ b/test/src/models/team_test.dart @@ -16,11 +16,11 @@ void main() { final map = model.toMap(); final result = Team.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'VIP'); - expect(result.total, 7); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'VIP'); + expect(result.total, 7); + }); }); } diff --git a/test/src/models/token_test.dart b/test/src/models/token_test.dart index 90ae6415..01cb97ff 100644 --- a/test/src/models/token_test.dart +++ b/test/src/models/token_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = Token.fromMap(map); - expect(result.$id, 'bb8ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5ea5c168bb8'); - expect(result.secret, ''); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.phrase, 'Golden Fox'); - }); + expect(result.$id, 'bb8ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5ea5c168bb8'); + expect(result.secret, ''); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.phrase, 'Golden Fox'); + }); }); } diff --git a/test/src/models/topic_list_test.dart b/test/src/models/topic_list_test.dart index bae2557b..617e46d3 100644 --- a/test/src/models/topic_list_test.dart +++ b/test/src/models/topic_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TopicList.fromMap(map); - expect(result.total, 5); - expect(result.topics, []); - }); + expect(result.total, 5); + expect(result.topics, []); + }); }); } diff --git a/test/src/models/topic_test.dart b/test/src/models/topic_test.dart index b5cf9bdd..1c244535 100644 --- a/test/src/models/topic_test.dart +++ b/test/src/models/topic_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Topic.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'events'); - expect(result.emailTotal, 100); - expect(result.smsTotal, 100); - expect(result.pushTotal, 100); - expect(result.subscribe, []); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'events'); + expect(result.emailTotal, 100); + expect(result.smsTotal, 100); + expect(result.pushTotal, 100); + expect(result.subscribe, []); + }); }); } diff --git a/test/src/models/transaction_list_test.dart b/test/src/models/transaction_list_test.dart index 09c2b67a..85e19be2 100644 --- a/test/src/models/transaction_list_test.dart +++ b/test/src/models/transaction_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TransactionList.fromMap(map); - expect(result.total, 5); - expect(result.transactions, []); - }); + expect(result.total, 5); + expect(result.transactions, []); + }); }); } diff --git a/test/src/models/transaction_test.dart b/test/src/models/transaction_test.dart index cd5f953f..3892d0dc 100644 --- a/test/src/models/transaction_test.dart +++ b/test/src/models/transaction_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = Transaction.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.status, 'pending'); - expect(result.operations, 5); - expect(result.expiresAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.status, 'pending'); + expect(result.operations, 5); + expect(result.expiresAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/user_list_test.dart b/test/src/models/user_list_test.dart index 3503253d..61b350b8 100644 --- a/test/src/models/user_list_test.dart +++ b/test/src/models/user_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = UserList.fromMap(map); - expect(result.total, 5); - expect(result.users, []); - }); + expect(result.total, 5); + expect(result.users, []); + }); }); } diff --git a/test/src/models/user_test.dart b/test/src/models/user_test.dart index f1283199..47e85f4b 100644 --- a/test/src/models/user_test.dart +++ b/test/src/models/user_test.dart @@ -26,21 +26,21 @@ void main() { final map = model.toMap(); final result = User.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'John Doe'); - expect(result.registration, '2020-10-15T06:38:00.000+00:00'); - expect(result.status, true); - expect(result.labels, []); - expect(result.passwordUpdate, '2020-10-15T06:38:00.000+00:00'); - expect(result.email, 'john@appwrite.io'); - expect(result.phone, '+4930901820'); - expect(result.emailVerification, true); - expect(result.phoneVerification, true); - expect(result.mfa, true); - expect(result.targets, []); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'John Doe'); + expect(result.registration, '2020-10-15T06:38:00.000+00:00'); + expect(result.status, true); + expect(result.labels, []); + expect(result.passwordUpdate, '2020-10-15T06:38:00.000+00:00'); + expect(result.email, 'john@appwrite.io'); + expect(result.phone, '+4930901820'); + expect(result.emailVerification, true); + expect(result.phoneVerification, true); + expect(result.mfa, true); + expect(result.targets, []); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/variable_list_test.dart b/test/src/models/variable_list_test.dart index b9de10b3..1ed9a0d3 100644 --- a/test/src/models/variable_list_test.dart +++ b/test/src/models/variable_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = VariableList.fromMap(map); - expect(result.total, 5); - expect(result.variables, []); - }); + expect(result.total, 5); + expect(result.variables, []); + }); }); } diff --git a/test/src/models/variable_test.dart b/test/src/models/variable_test.dart index 322de49b..5e2d0344 100644 --- a/test/src/models/variable_test.dart +++ b/test/src/models/variable_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Variable.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.key, 'API_KEY'); - expect(result.value, 'myPa\$\$word1'); - expect(result.secret, true); - expect(result.resourceType, 'function'); - expect(result.resourceId, 'myAwesomeFunction'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.key, 'API_KEY'); + expect(result.value, 'myPa\$\$word1'); + expect(result.secret, true); + expect(result.resourceType, 'function'); + expect(result.resourceId, 'myAwesomeFunction'); + }); }); } diff --git a/test/src/models/webhook_list_test.dart b/test/src/models/webhook_list_test.dart index c17b9143..0c5fb86e 100644 --- a/test/src/models/webhook_list_test.dart +++ b/test/src/models/webhook_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = WebhookList.fromMap(map); - expect(result.total, 5); - expect(result.webhooks, []); - }); + expect(result.total, 5); + expect(result.webhooks, []); + }); }); } diff --git a/test/src/models/webhook_test.dart b/test/src/models/webhook_test.dart index fd64e1db..c7a6bbb9 100644 --- a/test/src/models/webhook_test.dart +++ b/test/src/models/webhook_test.dart @@ -23,19 +23,19 @@ void main() { final map = model.toMap(); final result = Webhook.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Webhook'); - expect(result.url, 'https://example.com/webhook'); - expect(result.events, []); - expect(result.tls, true); - expect(result.authUsername, 'username'); - expect(result.authPassword, 'password'); - expect(result.secret, 'ad3d581ca230e2b7059c545e5a'); - expect(result.enabled, true); - expect(result.logs, 'Failed to connect to remote server.'); - expect(result.attempts, 10); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Webhook'); + expect(result.url, 'https://example.com/webhook'); + expect(result.events, []); + expect(result.tls, true); + expect(result.authUsername, 'username'); + expect(result.authPassword, 'password'); + expect(result.secret, 'ad3d581ca230e2b7059c545e5a'); + expect(result.enabled, true); + expect(result.logs, 'Failed to connect to remote server.'); + expect(result.attempts, 10); + }); }); } From 9a0ade19b40fb1e9a568eaa309283bff3c3b8eb0 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 8 May 2026 11:10:38 +0000 Subject: [PATCH 2/2] Commit from GitHub Actions (Format and push) --- lib/client_browser.dart | 2 +- lib/client_io.dart | 2 +- lib/operator.dart | 11 +- lib/query.dart | 91 +- lib/role.dart | 2 +- lib/services/account.dart | 987 ++- lib/services/activities.dart | 40 +- lib/services/avatars.dart | 224 +- lib/services/backups.dart | 243 +- lib/services/databases.dart | 2108 +++--- lib/services/functions.dart | 673 +- lib/services/graphql.dart | 36 +- lib/services/health.dart | 428 +- lib/services/locale.dart | 160 +- lib/services/messaging.dart | 1744 ++--- lib/services/presences.dart | 119 +- lib/services/project.dart | 1831 +++--- lib/services/proxy.dart | 164 +- lib/services/sites.dart | 636 +- lib/services/storage.dart | 342 +- lib/services/tables_db.dart | 1924 +++--- lib/services/teams.dart | 283 +- lib/services/tokens.dart | 93 +- lib/services/users.dart | 993 ++- lib/services/webhooks.dart | 148 +- lib/src/client.dart | 8 +- lib/src/client_base.dart | 11 +- lib/src/client_browser.dart | 173 +- lib/src/client_io.dart | 173 +- lib/src/client_mixin.dart | 35 +- lib/src/enums/adapter.dart | 14 +- lib/src/enums/attribute_status.dart | 20 +- lib/src/enums/authentication_factor.dart | 18 +- lib/src/enums/authenticator_type.dart | 12 +- lib/src/enums/backup_services.dart | 22 +- lib/src/enums/browser.dart | 38 +- lib/src/enums/browser_permission.dart | 50 +- lib/src/enums/build_runtime.dart | 188 +- lib/src/enums/column_status.dart | 20 +- lib/src/enums/compression.dart | 16 +- lib/src/enums/credit_card.dart | 44 +- lib/src/enums/database_type.dart | 18 +- lib/src/enums/databases_index_type.dart | 18 +- lib/src/enums/deployment_download_type.dart | 14 +- lib/src/enums/deployment_status.dart | 22 +- lib/src/enums/email_template_locale.dart | 272 +- lib/src/enums/email_template_type.dart | 24 +- lib/src/enums/execution_method.dart | 24 +- lib/src/enums/execution_status.dart | 20 +- lib/src/enums/execution_trigger.dart | 16 +- lib/src/enums/flag.dart | 400 +- lib/src/enums/framework.dart | 40 +- lib/src/enums/health_antivirus_status.dart | 16 +- lib/src/enums/health_check_status.dart | 14 +- lib/src/enums/image_format.dart | 24 +- lib/src/enums/image_gravity.dart | 28 +- lib/src/enums/index_status.dart | 20 +- lib/src/enums/message_priority.dart | 14 +- lib/src/enums/message_status.dart | 20 +- lib/src/enums/messaging_provider_type.dart | 16 +- lib/src/enums/method_id.dart | 24 +- lib/src/enums/name.dart | 36 +- lib/src/enums/o_auth_provider.dart | 96 +- lib/src/enums/order_by.dart | 14 +- lib/src/enums/password_hash.dart | 32 +- lib/src/enums/platform_type.dart | 20 +- lib/src/enums/policy_id.dart | 28 +- lib/src/enums/protocol_id.dart | 16 +- lib/src/enums/provider_id.dart | 104 +- lib/src/enums/proxy_resource_type.dart | 14 +- .../proxy_rule_deployment_resource_type.dart | 14 +- lib/src/enums/proxy_rule_status.dart | 16 +- lib/src/enums/relation_mutate.dart | 16 +- lib/src/enums/relationship_type.dart | 18 +- lib/src/enums/runtime.dart | 188 +- lib/src/enums/scopes.dart | 188 +- lib/src/enums/secure.dart | 14 +- lib/src/enums/service_id.dart | 44 +- lib/src/enums/smtp_encryption.dart | 16 +- lib/src/enums/status_code.dart | 18 +- lib/src/enums/tables_db_index_type.dart | 18 +- lib/src/enums/template_reference_type.dart | 16 +- lib/src/enums/theme.dart | 14 +- lib/src/enums/timezone.dart | 848 ++- lib/src/enums/vcs_reference_type.dart | 16 +- lib/src/exception.dart | 2 +- lib/src/models/activity_event.dart | 388 +- lib/src/models/activity_event_list.dart | 43 +- lib/src/models/algo_argon2.dart | 62 +- lib/src/models/algo_bcrypt.dart | 32 +- lib/src/models/algo_md5.dart | 32 +- lib/src/models/algo_phpass.dart | 32 +- lib/src/models/algo_scrypt.dart | 86 +- lib/src/models/algo_scrypt_modified.dart | 62 +- lib/src/models/algo_sha.dart | 32 +- lib/src/models/attribute_bigint.dart | 133 +- lib/src/models/attribute_boolean.dart | 113 +- lib/src/models/attribute_datetime.dart | 123 +- lib/src/models/attribute_email.dart | 123 +- lib/src/models/attribute_enum.dart | 133 +- lib/src/models/attribute_float.dart | 133 +- lib/src/models/attribute_integer.dart | 133 +- lib/src/models/attribute_ip.dart | 123 +- lib/src/models/attribute_line.dart | 113 +- lib/src/models/attribute_list.dart | 42 +- lib/src/models/attribute_longtext.dart | 123 +- lib/src/models/attribute_mediumtext.dart | 123 +- lib/src/models/attribute_point.dart | 113 +- lib/src/models/attribute_polygon.dart | 113 +- lib/src/models/attribute_relationship.dart | 195 +- lib/src/models/attribute_string.dart | 133 +- lib/src/models/attribute_text.dart | 123 +- lib/src/models/attribute_url.dart | 123 +- lib/src/models/attribute_varchar.dart | 133 +- lib/src/models/auth_provider.dart | 86 +- lib/src/models/backup_archive.dart | 142 +- lib/src/models/backup_archive_list.dart | 43 +- lib/src/models/backup_policy.dart | 132 +- lib/src/models/backup_policy_list.dart | 43 +- lib/src/models/backup_restoration.dart | 132 +- lib/src/models/backup_restoration_list.dart | 43 +- lib/src/models/billing_limits.dart | 102 +- lib/src/models/block.dart | 122 +- lib/src/models/bucket.dart | 194 +- lib/src/models/bucket_list.dart | 42 +- lib/src/models/collection.dart | 142 +- lib/src/models/collection_list.dart | 43 +- lib/src/models/column_bigint.dart | 133 +- lib/src/models/column_boolean.dart | 113 +- lib/src/models/column_datetime.dart | 123 +- lib/src/models/column_email.dart | 123 +- lib/src/models/column_enum.dart | 133 +- lib/src/models/column_float.dart | 133 +- lib/src/models/column_index.dart | 122 +- lib/src/models/column_index_list.dart | 43 +- lib/src/models/column_integer.dart | 133 +- lib/src/models/column_ip.dart | 123 +- lib/src/models/column_line.dart | 113 +- lib/src/models/column_list.dart | 42 +- lib/src/models/column_longtext.dart | 123 +- lib/src/models/column_mediumtext.dart | 123 +- lib/src/models/column_point.dart | 113 +- lib/src/models/column_polygon.dart | 113 +- lib/src/models/column_relationship.dart | 195 +- lib/src/models/column_string.dart | 133 +- lib/src/models/column_text.dart | 123 +- lib/src/models/column_url.dart | 123 +- lib/src/models/column_varchar.dart | 133 +- lib/src/models/continent.dart | 42 +- lib/src/models/continent_list.dart | 43 +- lib/src/models/country.dart | 42 +- lib/src/models/country_list.dart | 43 +- lib/src/models/currency.dart | 110 +- lib/src/models/currency_list.dart | 43 +- lib/src/models/database.dart | 103 +- lib/src/models/database_list.dart | 43 +- lib/src/models/deployment.dart | 341 +- lib/src/models/deployment_list.dart | 43 +- lib/src/models/dev_key.dart | 102 +- lib/src/models/document.dart | 102 +- lib/src/models/document_list.dart | 47 +- lib/src/models/email_template.dart | 102 +- lib/src/models/email_template_list.dart | 43 +- lib/src/models/ephemeral_key.dart | 112 +- lib/src/models/execution.dart | 246 +- lib/src/models/execution_list.dart | 43 +- lib/src/models/file.dart | 182 +- lib/src/models/file_list.dart | 42 +- lib/src/models/framework.dart | 87 +- lib/src/models/framework_adapter.dart | 86 +- lib/src/models/framework_list.dart | 43 +- lib/src/models/function.dart | 368 +- lib/src/models/function_list.dart | 42 +- lib/src/models/headers.dart | 42 +- lib/src/models/health_antivirus.dart | 43 +- lib/src/models/health_certificate.dart | 98 +- lib/src/models/health_queue.dart | 32 +- lib/src/models/health_status.dart | 53 +- lib/src/models/health_status_list.dart | 43 +- lib/src/models/health_time.dart | 52 +- lib/src/models/identity.dart | 122 +- lib/src/models/identity_list.dart | 43 +- lib/src/models/index.dart | 123 +- lib/src/models/index_list.dart | 42 +- lib/src/models/jwt.dart | 32 +- lib/src/models/key.dart | 112 +- lib/src/models/key_list.dart | 42 +- lib/src/models/language.dart | 52 +- lib/src/models/language_list.dart | 43 +- lib/src/models/locale.dart | 110 +- lib/src/models/locale_code.dart | 42 +- lib/src/models/locale_code_list.dart | 43 +- lib/src/models/log.dart | 290 +- lib/src/models/log_list.dart | 42 +- lib/src/models/membership.dart | 194 +- lib/src/models/membership_list.dart | 43 +- lib/src/models/message.dart | 183 +- lib/src/models/message_list.dart | 43 +- lib/src/models/mfa_challenge.dart | 62 +- lib/src/models/mfa_factors.dart | 62 +- lib/src/models/mfa_recovery_codes.dart | 32 +- lib/src/models/mfa_type.dart | 42 +- lib/src/models/mock_number.dart | 62 +- lib/src/models/mock_number_list.dart | 43 +- lib/src/models/model.dart | 2 +- lib/src/models/o_auth2_amazon.dart | 62 +- lib/src/models/o_auth2_apple.dart | 98 +- lib/src/models/o_auth2_auth0.dart | 86 +- lib/src/models/o_auth2_authentik.dart | 86 +- lib/src/models/o_auth2_autodesk.dart | 62 +- lib/src/models/o_auth2_bitbucket.dart | 62 +- lib/src/models/o_auth2_bitly.dart | 62 +- lib/src/models/o_auth2_box.dart | 62 +- lib/src/models/o_auth2_dailymotion.dart | 62 +- lib/src/models/o_auth2_discord.dart | 62 +- lib/src/models/o_auth2_disqus.dart | 62 +- lib/src/models/o_auth2_dropbox.dart | 62 +- lib/src/models/o_auth2_etsy.dart | 62 +- lib/src/models/o_auth2_facebook.dart | 62 +- lib/src/models/o_auth2_figma.dart | 62 +- lib/src/models/o_auth2_fusion_auth.dart | 86 +- lib/src/models/o_auth2_github.dart | 62 +- lib/src/models/o_auth2_gitlab.dart | 86 +- lib/src/models/o_auth2_google.dart | 62 +- lib/src/models/o_auth2_keycloak.dart | 98 +- lib/src/models/o_auth2_kick.dart | 62 +- lib/src/models/o_auth2_linkedin.dart | 62 +- lib/src/models/o_auth2_microsoft.dart | 86 +- lib/src/models/o_auth2_notion.dart | 62 +- lib/src/models/o_auth2_oidc.dart | 102 +- lib/src/models/o_auth2_okta.dart | 98 +- lib/src/models/o_auth2_paypal.dart | 62 +- lib/src/models/o_auth2_podio.dart | 62 +- lib/src/models/o_auth2_provider_list.dart | 42 +- lib/src/models/o_auth2_salesforce.dart | 62 +- lib/src/models/o_auth2_slack.dart | 62 +- lib/src/models/o_auth2_spotify.dart | 62 +- lib/src/models/o_auth2_stripe.dart | 62 +- lib/src/models/o_auth2_tradeshift.dart | 62 +- lib/src/models/o_auth2_twitch.dart | 62 +- lib/src/models/o_auth2_word_press.dart | 62 +- lib/src/models/o_auth2_x.dart | 62 +- lib/src/models/o_auth2_yahoo.dart | 62 +- lib/src/models/o_auth2_yandex.dart | 62 +- lib/src/models/o_auth2_zoho.dart | 62 +- lib/src/models/o_auth2_zoom.dart | 62 +- lib/src/models/phone.dart | 52 +- lib/src/models/phone_list.dart | 42 +- lib/src/models/platform_android.dart | 98 +- lib/src/models/platform_apple.dart | 98 +- lib/src/models/platform_linux.dart | 98 +- lib/src/models/platform_list.dart | 42 +- lib/src/models/platform_web.dart | 98 +- lib/src/models/platform_windows.dart | 98 +- lib/src/models/policy_list.dart | 42 +- lib/src/models/policy_membership_privacy.dart | 98 +- .../models/policy_password_dictionary.dart | 42 +- lib/src/models/policy_password_history.dart | 42 +- .../models/policy_password_personal_data.dart | 42 +- lib/src/models/policy_session_alert.dart | 42 +- lib/src/models/policy_session_duration.dart | 42 +- .../models/policy_session_invalidation.dart | 42 +- lib/src/models/policy_session_limit.dart | 42 +- lib/src/models/policy_user_limit.dart | 42 +- lib/src/models/preferences.dart | 32 +- lib/src/models/presence.dart | 132 +- lib/src/models/presence_list.dart | 47 +- lib/src/models/project.dart | 871 +-- lib/src/models/provider.dart | 112 +- lib/src/models/provider_list.dart | 43 +- lib/src/models/proxy_rule.dart | 211 +- lib/src/models/proxy_rule_list.dart | 43 +- lib/src/models/resource_token.dart | 110 +- lib/src/models/resource_token_list.dart | 43 +- lib/src/models/row.dart | 102 +- lib/src/models/row_list.dart | 46 +- lib/src/models/runtime.dart | 102 +- lib/src/models/runtime_list.dart | 43 +- lib/src/models/session.dart | 360 +- lib/src/models/session_list.dart | 43 +- lib/src/models/site.dart | 388 +- lib/src/models/site_list.dart | 42 +- lib/src/models/specification.dart | 62 +- lib/src/models/specification_list.dart | 43 +- lib/src/models/subscriber.dart | 112 +- lib/src/models/subscriber_list.dart | 43 +- lib/src/models/table.dart | 143 +- lib/src/models/table_list.dart | 42 +- lib/src/models/target.dart | 112 +- lib/src/models/target_list.dart | 42 +- lib/src/models/team.dart | 98 +- lib/src/models/team_list.dart | 42 +- lib/src/models/token.dart | 98 +- lib/src/models/topic.dart | 102 +- lib/src/models/topic_list.dart | 42 +- lib/src/models/transaction.dart | 98 +- lib/src/models/transaction_list.dart | 43 +- lib/src/models/user.dart | 278 +- lib/src/models/user_list.dart | 42 +- lib/src/models/variable.dart | 102 +- lib/src/models/variable_list.dart | 43 +- lib/src/models/webhook.dart | 182 +- lib/src/models/webhook_list.dart | 43 +- test/query_test.dart | 1 - test/services/account_test.dart | 2546 ++++---- test/services/activities_test.dart | 143 +- test/services/avatars_test.dart | 188 +- test/services/backups_test.dart | 490 +- test/services/databases_test.dart | 3249 +++++----- test/services/functions_test.dart | 1482 ++--- test/services/graphql_test.dart | 63 +- test/services/health_test.dart | 644 +- test/services/locale_test.dart | 245 +- test/services/messaging_test.dart | 2416 ++++--- test/services/presences_test.dart | 210 +- test/services/project_test.dart | 5753 ++++++++--------- test/services/proxy_test.dart | 429 +- test/services/sites_test.dart | 1437 ++-- test/services/storage_test.dart | 545 +- test/services/tables_db_test.dart | 3249 +++++----- test/services/teams_test.dart | 539 +- test/services/tokens_test.dart | 212 +- test/services/users_test.dart | 2212 +++---- test/services/webhooks_test.dart | 301 +- test/src/models/activity_event_list_test.dart | 6 +- test/src/models/activity_event_test.dart | 70 +- test/src/models/algo_argon2_test.dart | 10 +- test/src/models/algo_bcrypt_test.dart | 4 +- test/src/models/algo_md5_test.dart | 4 +- test/src/models/algo_phpass_test.dart | 4 +- .../src/models/algo_scrypt_modified_test.dart | 14 +- test/src/models/algo_scrypt_test.dart | 12 +- test/src/models/algo_sha_test.dart | 4 +- test/src/models/attribute_bigint_test.dart | 16 +- test/src/models/attribute_boolean_test.dart | 16 +- test/src/models/attribute_datetime_test.dart | 18 +- test/src/models/attribute_email_test.dart | 18 +- test/src/models/attribute_enum_test.dart | 20 +- test/src/models/attribute_float_test.dart | 16 +- test/src/models/attribute_integer_test.dart | 16 +- test/src/models/attribute_ip_test.dart | 18 +- test/src/models/attribute_line_test.dart | 16 +- test/src/models/attribute_list_test.dart | 6 +- test/src/models/attribute_longtext_test.dart | 16 +- .../src/models/attribute_mediumtext_test.dart | 16 +- test/src/models/attribute_point_test.dart | 16 +- test/src/models/attribute_polygon_test.dart | 16 +- .../models/attribute_relationship_test.dart | 28 +- test/src/models/attribute_string_test.dart | 18 +- test/src/models/attribute_text_test.dart | 16 +- test/src/models/attribute_url_test.dart | 18 +- test/src/models/attribute_varchar_test.dart | 18 +- test/src/models/auth_provider_test.dart | 12 +- test/src/models/backup_archive_list_test.dart | 6 +- test/src/models/backup_archive_test.dart | 22 +- test/src/models/backup_policy_list_test.dart | 6 +- test/src/models/backup_policy_test.dart | 20 +- .../models/backup_restoration_list_test.dart | 6 +- test/src/models/backup_restoration_test.dart | 24 +- test/src/models/billing_limits_test.dart | 18 +- test/src/models/block_test.dart | 18 +- test/src/models/bucket_list_test.dart | 6 +- test/src/models/bucket_test.dart | 30 +- test/src/models/collection_list_test.dart | 6 +- test/src/models/collection_test.dart | 26 +- test/src/models/column_bigint_test.dart | 16 +- test/src/models/column_boolean_test.dart | 16 +- test/src/models/column_datetime_test.dart | 18 +- test/src/models/column_email_test.dart | 18 +- test/src/models/column_enum_test.dart | 20 +- test/src/models/column_float_test.dart | 16 +- test/src/models/column_index_list_test.dart | 6 +- test/src/models/column_index_test.dart | 20 +- test/src/models/column_integer_test.dart | 16 +- test/src/models/column_ip_test.dart | 18 +- test/src/models/column_line_test.dart | 16 +- test/src/models/column_list_test.dart | 6 +- test/src/models/column_longtext_test.dart | 16 +- test/src/models/column_mediumtext_test.dart | 16 +- test/src/models/column_point_test.dart | 16 +- test/src/models/column_polygon_test.dart | 16 +- test/src/models/column_relationship_test.dart | 28 +- test/src/models/column_string_test.dart | 18 +- test/src/models/column_text_test.dart | 16 +- test/src/models/column_url_test.dart | 18 +- test/src/models/column_varchar_test.dart | 18 +- test/src/models/continent_list_test.dart | 6 +- test/src/models/continent_test.dart | 6 +- test/src/models/country_list_test.dart | 6 +- test/src/models/country_test.dart | 6 +- test/src/models/currency_list_test.dart | 6 +- test/src/models/currency_test.dart | 16 +- test/src/models/database_list_test.dart | 6 +- test/src/models/database_test.dart | 18 +- test/src/models/deployment_list_test.dart | 6 +- test/src/models/deployment_test.dart | 69 +- test/src/models/dev_key_test.dart | 18 +- test/src/models/document_list_test.dart | 6 +- test/src/models/document_test.dart | 16 +- test/src/models/email_template_list_test.dart | 6 +- test/src/models/email_template_test.dart | 18 +- test/src/models/ephemeral_key_test.dart | 20 +- test/src/models/execution_list_test.dart | 6 +- test/src/models/execution_test.dart | 36 +- test/src/models/file_list_test.dart | 6 +- test/src/models/file_test.dart | 28 +- test/src/models/framework_adapter_test.dart | 12 +- test/src/models/framework_list_test.dart | 6 +- test/src/models/framework_test.dart | 12 +- test/src/models/function_list_test.dart | 6 +- test/src/models/function_test.dart | 62 +- test/src/models/headers_test.dart | 6 +- test/src/models/health_antivirus_test.dart | 6 +- test/src/models/health_certificate_test.dart | 14 +- test/src/models/health_queue_test.dart | 4 +- test/src/models/health_status_list_test.dart | 6 +- test/src/models/health_status_test.dart | 8 +- test/src/models/health_time_test.dart | 8 +- test/src/models/identity_list_test.dart | 6 +- test/src/models/identity_test.dart | 22 +- test/src/models/index_list_test.dart | 6 +- test/src/models/index_test.dart | 20 +- test/src/models/jwt_test.dart | 8 +- test/src/models/key_list_test.dart | 6 +- test/src/models/key_test.dart | 20 +- test/src/models/language_list_test.dart | 6 +- test/src/models/language_test.dart | 8 +- test/src/models/locale_code_list_test.dart | 6 +- test/src/models/locale_code_test.dart | 6 +- test/src/models/locale_test.dart | 16 +- test/src/models/log_list_test.dart | 6 +- test/src/models/log_test.dart | 46 +- test/src/models/membership_list_test.dart | 6 +- test/src/models/membership_test.dart | 30 +- test/src/models/message_list_test.dart | 6 +- test/src/models/message_test.dart | 22 +- test/src/models/mfa_challenge_test.dart | 10 +- test/src/models/mfa_factors_test.dart | 10 +- test/src/models/mfa_recovery_codes_test.dart | 4 +- test/src/models/mfa_type_test.dart | 10 +- test/src/models/mock_number_list_test.dart | 6 +- test/src/models/mock_number_test.dart | 10 +- test/src/models/o_auth2_amazon_test.dart | 18 +- test/src/models/o_auth2_apple_test.dart | 18 +- test/src/models/o_auth2_auth0_test.dart | 16 +- test/src/models/o_auth2_authentik_test.dart | 16 +- test/src/models/o_auth2_autodesk_test.dart | 10 +- test/src/models/o_auth2_bitbucket_test.dart | 10 +- test/src/models/o_auth2_bitly_test.dart | 10 +- test/src/models/o_auth2_box_test.dart | 10 +- test/src/models/o_auth2_dailymotion_test.dart | 10 +- test/src/models/o_auth2_discord_test.dart | 10 +- test/src/models/o_auth2_disqus_test.dart | 18 +- test/src/models/o_auth2_dropbox_test.dart | 10 +- test/src/models/o_auth2_etsy_test.dart | 10 +- test/src/models/o_auth2_facebook_test.dart | 10 +- test/src/models/o_auth2_figma_test.dart | 10 +- test/src/models/o_auth2_fusion_auth_test.dart | 13 +- test/src/models/o_auth2_github_test.dart | 10 +- test/src/models/o_auth2_gitlab_test.dart | 20 +- test/src/models/o_auth2_google_test.dart | 11 +- test/src/models/o_auth2_keycloak_test.dart | 14 +- test/src/models/o_auth2_kick_test.dart | 14 +- test/src/models/o_auth2_linkedin_test.dart | 10 +- test/src/models/o_auth2_microsoft_test.dart | 12 +- test/src/models/o_auth2_notion_test.dart | 11 +- test/src/models/o_auth2_oidc_test.dart | 23 +- test/src/models/o_auth2_okta_test.dart | 18 +- test/src/models/o_auth2_paypal_test.dart | 18 +- test/src/models/o_auth2_podio_test.dart | 14 +- .../models/o_auth2_provider_list_test.dart | 6 +- test/src/models/o_auth2_salesforce_test.dart | 14 +- test/src/models/o_auth2_slack_test.dart | 10 +- test/src/models/o_auth2_spotify_test.dart | 10 +- test/src/models/o_auth2_stripe_test.dart | 14 +- test/src/models/o_auth2_tradeshift_test.dart | 10 +- test/src/models/o_auth2_twitch_test.dart | 10 +- test/src/models/o_auth2_word_press_test.dart | 14 +- test/src/models/o_auth2_x_test.dart | 11 +- test/src/models/o_auth2_yahoo_test.dart | 14 +- test/src/models/o_auth2_yandex_test.dart | 10 +- test/src/models/o_auth2_zoho_test.dart | 10 +- test/src/models/o_auth2_zoom_test.dart | 10 +- test/src/models/phone_list_test.dart | 6 +- test/src/models/phone_test.dart | 8 +- test/src/models/platform_android_test.dart | 14 +- test/src/models/platform_apple_test.dart | 14 +- test/src/models/platform_linux_test.dart | 14 +- test/src/models/platform_list_test.dart | 6 +- test/src/models/platform_web_test.dart | 14 +- test/src/models/platform_windows_test.dart | 14 +- test/src/models/policy_list_test.dart | 6 +- .../policy_membership_privacy_test.dart | 14 +- .../policy_password_dictionary_test.dart | 6 +- .../models/policy_password_history_test.dart | 6 +- .../policy_password_personal_data_test.dart | 6 +- .../src/models/policy_session_alert_test.dart | 6 +- .../models/policy_session_duration_test.dart | 6 +- .../policy_session_invalidation_test.dart | 6 +- .../src/models/policy_session_limit_test.dart | 6 +- test/src/models/policy_user_limit_test.dart | 6 +- test/src/models/preferences_test.dart | 1 - test/src/models/presence_list_test.dart | 6 +- test/src/models/presence_test.dart | 18 +- test/src/models/project_test.dart | 180 +- test/src/models/provider_list_test.dart | 6 +- test/src/models/provider_test.dart | 18 +- test/src/models/proxy_rule_list_test.dart | 6 +- test/src/models/proxy_rule_test.dart | 34 +- test/src/models/resource_token_list_test.dart | 6 +- test/src/models/resource_token_test.dart | 20 +- test/src/models/row_list_test.dart | 6 +- test/src/models/row_test.dart | 16 +- test/src/models/runtime_list_test.dart | 6 +- test/src/models/runtime_test.dart | 18 +- test/src/models/session_list_test.dart | 6 +- test/src/models/session_test.dart | 60 +- test/src/models/site_list_test.dart | 6 +- test/src/models/site_test.dart | 66 +- test/src/models/specification_list_test.dart | 6 +- test/src/models/specification_test.dart | 10 +- test/src/models/subscriber_list_test.dart | 6 +- test/src/models/subscriber_test.dart | 36 +- test/src/models/table_list_test.dart | 6 +- test/src/models/table_test.dart | 26 +- test/src/models/target_list_test.dart | 6 +- test/src/models/target_test.dart | 18 +- test/src/models/team_list_test.dart | 6 +- test/src/models/team_test.dart | 12 +- test/src/models/token_test.dart | 14 +- test/src/models/topic_list_test.dart | 6 +- test/src/models/topic_test.dart | 18 +- test/src/models/transaction_list_test.dart | 6 +- test/src/models/transaction_test.dart | 14 +- test/src/models/user_list_test.dart | 6 +- test/src/models/user_test.dart | 32 +- test/src/models/variable_list_test.dart | 6 +- test/src/models/variable_test.dart | 18 +- test/src/models/webhook_list_test.dart | 6 +- test/src/models/webhook_test.dart | 28 +- 540 files changed, 32844 insertions(+), 33814 deletions(-) diff --git a/lib/client_browser.dart b/lib/client_browser.dart index 09f110ea..b9805a3a 100644 --- a/lib/client_browser.dart +++ b/lib/client_browser.dart @@ -1 +1 @@ -export 'src/client_browser.dart'; \ No newline at end of file +export 'src/client_browser.dart'; diff --git a/lib/client_io.dart b/lib/client_io.dart index 4d85cbfa..42a0c0b6 100644 --- a/lib/client_io.dart +++ b/lib/client_io.dart @@ -1 +1 @@ -export 'src/client_io.dart'; \ No newline at end of file +export 'src/client_io.dart'; diff --git a/lib/operator.dart b/lib/operator.dart index e2e4c84d..6572e0e5 100644 --- a/lib/operator.dart +++ b/lib/operator.dart @@ -31,7 +31,7 @@ class Operator { result['method'] = method; - if(values != null) { + if (values != null) { result['values'] = values is List ? values : [values]; } @@ -147,8 +147,7 @@ class Operator { Operator._('arrayRemove', [value]).toString(); /// Remove duplicate values from an array attribute. - static String arrayUnique() => - Operator._('arrayUnique', []).toString(); + static String arrayUnique() => Operator._('arrayUnique', []).toString(); /// Keep only values that exist in both the current array and the provided array. static String arrayIntersect(List values) => @@ -173,8 +172,7 @@ class Operator { Operator._('stringReplace', [search, replace]).toString(); /// Toggle a boolean attribute. - static String toggle() => - Operator._('toggle', []).toString(); + static String toggle() => Operator._('toggle', []).toString(); /// Add days to a date attribute. static String dateAddDays(int days) => @@ -185,6 +183,5 @@ class Operator { Operator._('dateSubDays', [days]).toString(); /// Set a date attribute to the current date and time. - static String dateSetNow() => - Operator._('dateSetNow', []).toString(); + static String dateSetNow() => Operator._('dateSetNow', []).toString(); } diff --git a/lib/query.dart b/lib/query.dart index c643a4be..1ee04fa4 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -10,14 +10,14 @@ class Query { Map toJson() { final result = {}; - + result['method'] = method; - - if(attribute != null) { + + if (attribute != null) { result['attribute'] = attribute; } - - if(values != null) { + + if (values != null) { result['values'] = values is List ? values : [values]; } @@ -28,7 +28,7 @@ class Query { String toString() => jsonEncode(toJson()); /// Filter resources where [attribute] is equal to [value]. - /// + /// /// [value] can be a single value or a list. If a list is used /// the query will return resources where [attribute] is equal /// to any of the values in the list. @@ -140,50 +140,46 @@ class Query { Query._('notEndsWith', attribute, value).toString(); /// Filter resources where document was created before [value]. - static String createdBefore(String value) => - lessThan('\$createdAt', value); + static String createdBefore(String value) => lessThan('\$createdAt', value); /// Filter resources where document was created after [value]. - static String createdAfter(String value) => - greaterThan('\$createdAt', value); + static String createdAfter(String value) => greaterThan('\$createdAt', value); /// Filter resources where document was created between [start] and [end] (inclusive). static String createdBetween(String start, String end) => between('\$createdAt', start, end); /// Filter resources where document was updated before [value]. - static String updatedBefore(String value) => - lessThan('\$updatedAt', value); + static String updatedBefore(String value) => lessThan('\$updatedAt', value); /// Filter resources where document was updated after [value]. - static String updatedAfter(String value) => - greaterThan('\$updatedAt', value); + static String updatedAfter(String value) => greaterThan('\$updatedAt', value); /// Filter resources where document was updated between [start] and [end] (inclusive). static String updatedBetween(String start, String end) => between('\$updatedAt', start, end); static String or(List queries) => Query._( - 'or', - null, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + 'or', + null, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); static String and(List queries) => Query._( - 'and', - null, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + 'and', + null, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); /// Filter array elements where at least one element matches all the specified queries. /// /// [attribute] The attribute containing the array to filter on. /// [queries] The list of query strings to match against array elements. static String elemMatch(String attribute, List queries) => Query._( - 'elemMatch', - attribute, - queries.map((query) => jsonDecode(query)).toList(), - ).toString(); + 'elemMatch', + attribute, + queries.map((query) => jsonDecode(query)).toList(), + ).toString(); /// Specify which attributes should be returned by the API call. static String select(List attributes) => @@ -198,18 +194,17 @@ class Query { Query._('orderDesc', attribute).toString(); /// Sort results randomly. - static String orderRandom() => - Query._('orderRandom').toString(); + static String orderRandom() => Query._('orderRandom').toString(); /// Return results before [id]. - /// + /// /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) /// docs for more information. static String cursorBefore(String id) => Query._('cursorBefore', null, id).toString(); /// Return results after [id]. - /// + /// /// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination) /// docs for more information. static String cursorAfter(String id) => @@ -219,27 +214,43 @@ class Query { static String limit(int limit) => Query._('limit', null, limit).toString(); /// Return results from [offset]. - /// + /// /// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination) /// docs for more information. static String offset(int offset) => Query._('offset', null, offset).toString(); /// Filter resources where [attribute] is at a specific distance from the given coordinates. - static String distanceEqual(String attribute, List values, num distance, [bool meters = true]) => - Query._('distanceEqual', attribute, [[values, distance, meters]]).toString(); + static String distanceEqual( + String attribute, List values, num distance, + [bool meters = true]) => + Query._('distanceEqual', attribute, [ + [values, distance, meters] + ]).toString(); /// Filter resources where [attribute] is not at a specific distance from the given coordinates. - static String distanceNotEqual(String attribute, List values, num distance, [bool meters = true]) => - Query._('distanceNotEqual', attribute, [[values, distance, meters]]).toString(); + static String distanceNotEqual( + String attribute, List values, num distance, + [bool meters = true]) => + Query._('distanceNotEqual', attribute, [ + [values, distance, meters] + ]).toString(); /// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates. - static String distanceGreaterThan(String attribute, List values, num distance, [bool meters = true]) => - Query._('distanceGreaterThan', attribute, [[values, distance, meters]]).toString(); + static String distanceGreaterThan( + String attribute, List values, num distance, + [bool meters = true]) => + Query._('distanceGreaterThan', attribute, [ + [values, distance, meters] + ]).toString(); /// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates. - static String distanceLessThan(String attribute, List values, num distance, [bool meters = true]) => - Query._('distanceLessThan', attribute, [[values, distance, meters]]).toString(); + static String distanceLessThan( + String attribute, List values, num distance, + [bool meters = true]) => + Query._('distanceLessThan', attribute, [ + [values, distance, meters] + ]).toString(); /// Filter resources where [attribute] intersects with the given geometry. static String intersects(String attribute, List values) => @@ -272,4 +283,4 @@ class Query { /// Filter resources where [attribute] does not touch the given geometry. static String notTouches(String attribute, List values) => Query._('notTouches', attribute, [values]).toString(); -} \ No newline at end of file +} diff --git a/lib/role.dart b/lib/role.dart index 9208f5b6..dafeb78d 100644 --- a/lib/role.dart +++ b/lib/role.dart @@ -63,4 +63,4 @@ class Role { static String label(String name) { return 'label:$name'; } -} \ No newline at end of file +} diff --git a/lib/services/account.dart b/lib/services/account.dart index 51676a9d..f1c16b65 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -1,27 +1,22 @@ part of '../dart_appwrite.dart'; - /// The Account service allows you to authenticate and manage a user account. +/// The Account service allows you to authenticate and manage a user account. class Account extends Service { - Account(super.client); + Account(super.client); /// Get the currently logged in user. - Future get() async { - final String apiPath = '/account'; + Future get() async { + final String apiPath = '/account'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Use this endpoint to allow a new user to register a new account in your /// project. After the user registration completes successfully, you can use @@ -30,28 +25,29 @@ class Account extends Service { /// route to start verifying the user email address. To allow the new user to /// login to their new account, you need to create a new [account /// session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). - Future create({required String userId, required String email, required String password, String? name}) async { - final String apiPath = '/account'; + Future create( + {required String userId, + required String email, + required String password, + String? name}) async { + final String apiPath = '/account'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Update currently logged in user account email address. After changing user /// address, the user confirmation status will get reset. A new confirmation @@ -60,664 +56,584 @@ if (name != null) 'name': name, /// user password is required to complete this request. /// This endpoint can also be used to convert an anonymous account to a normal /// one, by passing an email address and a new password. - /// - Future updateEmail({required String email, required String password}) async { - final String apiPath = '/account/email'; + /// + Future updateEmail( + {required String email, required String password}) async { + final String apiPath = '/account/email'; final Map apiParams = { - 'email': email, -'password': password, - + 'password': password, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Get the list of identities for the currently logged in user. - Future listIdentities({List? queries, bool? total}) async { - final String apiPath = '/account/identities'; + Future listIdentities( + {List? queries, bool? total}) async { + final String apiPath = '/account/identities'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.IdentityList.fromMap(res.data); - - } + } /// Delete an identity by its unique ID. - Future deleteIdentity({required String identityId}) async { - final String apiPath = '/account/identities/{identityId}'.replaceAll('{identityId}', identityId); + Future deleteIdentity({required String identityId}) async { + final String apiPath = '/account/identities/{identityId}' + .replaceAll('{identityId}', identityId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Use this endpoint to create a JSON Web Token. You can use the resulting JWT /// to authenticate on behalf of the current user when working with the /// Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes /// from its creation and will be invalid if the user will logout in that time /// frame. - Future createJWT({int? duration}) async { - final String apiPath = '/account/jwts'; + Future createJWT({int? duration}) async { + final String apiPath = '/account/jwts'; final Map apiParams = { - if (duration != null) 'duration': duration, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Jwt.fromMap(res.data); - - } + } /// Get the list of latest security activity logs for the currently logged in /// user. Each log returns user IP address, location and date and time of log. - Future listLogs({List? queries, bool? total}) async { - final String apiPath = '/account/logs'; + Future listLogs({List? queries, bool? total}) async { + final String apiPath = '/account/logs'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - - } + } /// Enable or disable MFA on an account. - Future updateMFA({required bool mfa}) async { - final String apiPath = '/account/mfa'; + Future updateMFA({required bool mfa}) async { + final String apiPath = '/account/mfa'; final Map apiParams = { - 'mfa': mfa, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Add an authenticator app to be used as an MFA factor. Verify the /// authenticator using the [verify /// authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.') - Future createMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.') + Future createMfaAuthenticator( + {required enums.AuthenticatorType type}) async { + final String apiPath = + '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaType.fromMap(res.data); - - } + } /// Add an authenticator app to be used as an MFA factor. Verify the /// authenticator using the [verify /// authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) /// method. - Future createMFAAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + Future createMFAAuthenticator( + {required enums.AuthenticatorType type}) async { + final String apiPath = + '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaType.fromMap(res.data); - - } + } /// Verify an authenticator app after adding it using the [add /// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.') - Future updateMfaAuthenticator({required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.') + Future updateMfaAuthenticator( + {required enums.AuthenticatorType type, required String otp}) async { + final String apiPath = + '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); final Map apiParams = { - 'otp': otp, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Verify an authenticator app after adding it using the [add /// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) /// method. - Future updateMFAAuthenticator({required enums.AuthenticatorType type, required String otp}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + Future updateMFAAuthenticator( + {required enums.AuthenticatorType type, required String otp}) async { + final String apiPath = + '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); final Map apiParams = { - 'otp': otp, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Delete an authenticator for a user by ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.') - Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.') + Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = + '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Delete an authenticator for a user by ID. - Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { - final String apiPath = '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); + Future deleteMFAAuthenticator({required enums.AuthenticatorType type}) async { + final String apiPath = + '/account/mfa/authenticators/{type}'.replaceAll('{type}', type.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Begin the process of MFA verification after sign-in. Finish the flow with /// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.') - Future createMfaChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenges'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.') + Future createMfaChallenge( + {required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { - 'factor': factor.value, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaChallenge.fromMap(res.data); - - } + } /// Begin the process of MFA verification after sign-in. Finish the flow with /// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) /// method. - Future createMFAChallenge({required enums.AuthenticationFactor factor}) async { - final String apiPath = '/account/mfa/challenges'; + Future createMFAChallenge( + {required enums.AuthenticationFactor factor}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { - 'factor': factor.value, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaChallenge.fromMap(res.data); - - } + } /// Complete the MFA challenge by providing the one-time password. Finish the /// process of MFA verification by providing the one-time password. To begin /// the flow, use /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.') - Future updateMfaChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenges'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.') + Future updateMfaChallenge( + {required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Complete the MFA challenge by providing the one-time password. Finish the /// process of MFA verification by providing the one-time password. To begin /// the flow, use /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - Future updateMFAChallenge({required String challengeId, required String otp}) async { - final String apiPath = '/account/mfa/challenges'; + Future updateMFAChallenge( + {required String challengeId, required String otp}) async { + final String apiPath = '/account/mfa/challenges'; final Map apiParams = { - 'challengeId': challengeId, -'otp': otp, - + 'otp': otp, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// List the factors available on the account to be used as a MFA challange. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.') - Future listMfaFactors() async { - final String apiPath = '/account/mfa/factors'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.') + Future listMfaFactors() async { + final String apiPath = '/account/mfa/factors'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - - } + } /// List the factors available on the account to be used as a MFA challange. - Future listMFAFactors() async { - final String apiPath = '/account/mfa/factors'; + Future listMFAFactors() async { + final String apiPath = '/account/mfa/factors'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - - } + } /// Get recovery codes that can be used as backup for MFA flow. Before getting /// codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to read recovery codes. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.') + Future getMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Get recovery codes that can be used as backup for MFA flow. Before getting /// codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to read recovery codes. - Future getMFARecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + Future getMFARecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Generate recovery codes as backup for MFA flow. It's recommended to /// generate and show then immediately after user successfully adds their /// authehticator. Recovery codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.') + Future createMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Generate recovery codes as backup for MFA flow. It's recommended to /// generate and show then immediately after user successfully adds their /// authehticator. Recovery codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method. - Future createMFARecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + Future createMFARecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Regenerate recovery codes that can be used as backup for MFA flow. Before /// regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to regenreate recovery codes. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Regenerate recovery codes that can be used as backup for MFA flow. Before /// regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. An OTP challenge is required to regenreate recovery codes. - Future updateMFARecoveryCodes() async { - final String apiPath = '/account/mfa/recovery-codes'; + Future updateMFARecoveryCodes() async { + final String apiPath = '/account/mfa/recovery-codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Update currently logged in user account name. - Future updateName({required String name}) async { - final String apiPath = '/account/name'; + Future updateName({required String name}) async { + final String apiPath = '/account/name'; final Map apiParams = { - 'name': name, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Update currently logged in user password. For validation, user is required /// to pass in the new password, and the old password. For users created with /// OAuth, Team Invites and Magic URL, oldPassword is optional. - Future updatePassword({required String password, String? oldPassword}) async { - final String apiPath = '/account/password'; + Future updatePassword( + {required String password, String? oldPassword}) async { + final String apiPath = '/account/password'; final Map apiParams = { - 'password': password, -if (oldPassword != null) 'oldPassword': oldPassword, - + if (oldPassword != null) 'oldPassword': oldPassword, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Update the currently logged in user's phone number. After updating the /// phone number, the phone verification status will be reset. A confirmation /// SMS is not sent automatically, however you can use the [POST /// /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) /// endpoint to send a confirmation SMS. - Future updatePhone({required String phone, required String password}) async { - final String apiPath = '/account/phone'; + Future updatePhone( + {required String phone, required String password}) async { + final String apiPath = '/account/phone'; final Map apiParams = { - 'phone': phone, -'password': password, - + 'password': password, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Get the preferences as a key-value object for the currently logged in user. - Future getPrefs() async { - final String apiPath = '/account/prefs'; + Future getPrefs() async { + final String apiPath = '/account/prefs'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - - } + } /// Update currently logged in user account preferences. The object you pass is /// stored as is, and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws error if exceeded. - Future updatePrefs({required Map prefs}) async { - final String apiPath = '/account/prefs'; + Future updatePrefs({required Map prefs}) async { + final String apiPath = '/account/prefs'; final Map apiParams = { - 'prefs': prefs, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Sends the user an email with a temporary secret key for password reset. /// When the user clicks the confirmation link he is redirected back to your @@ -727,99 +643,88 @@ if (oldPassword != null) 'oldPassword': oldPassword, /// /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) /// endpoint to complete the process. The verification link sent to the user's /// email address is valid for 1 hour. - Future createRecovery({required String email, required String url}) async { - final String apiPath = '/account/recovery'; + Future createRecovery( + {required String email, required String url}) async { + final String apiPath = '/account/recovery'; final Map apiParams = { - 'email': email, -'url': url, - + 'url': url, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to complete the user account password reset. Both the /// **userId** and **secret** arguments will be passed as query parameters to /// the redirect URL you have provided when sending your request to the [POST /// /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) /// endpoint. - /// + /// /// Please note that in order to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - Future updateRecovery({required String userId, required String secret, required String password}) async { - final String apiPath = '/account/recovery'; + Future updateRecovery( + {required String userId, + required String secret, + required String password}) async { + final String apiPath = '/account/recovery'; final Map apiParams = { - 'userId': userId, -'secret': secret, -'password': password, - + 'secret': secret, + 'password': password, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Get the list of active sessions across different devices for the currently /// logged in user. - Future listSessions() async { - final String apiPath = '/account/sessions'; + Future listSessions() async { + final String apiPath = '/account/sessions'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.SessionList.fromMap(res.data); - - } + } /// Delete all sessions from the user account and remove any sessions cookies /// from the end client. - Future deleteSessions() async { - final String apiPath = '/account/sessions'; + Future deleteSessions() async { + final String apiPath = '/account/sessions'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Use this endpoint to allow a new user to register an anonymous account in /// your project. This route will also create a new session for the user. To @@ -828,213 +733,189 @@ if (oldPassword != null) 'oldPassword': oldPassword, /// password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) /// or create an [OAuth2 /// session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). - Future createAnonymousSession() async { - final String apiPath = '/account/sessions/anonymous'; + Future createAnonymousSession() async { + final String apiPath = '/account/sessions/anonymous'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Allow the user to login into their account by providing a valid email and /// password combination. This route will create a new session for the user. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - Future createEmailPasswordSession({required String email, required String password}) async { - final String apiPath = '/account/sessions/email'; + Future createEmailPasswordSession( + {required String email, required String password}) async { + final String apiPath = '/account/sessions/email'; final Map apiParams = { - 'email': email, -'password': password, - + 'password': password, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. - @Deprecated('This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') - Future updateMagicURLSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/magic-url'; + @Deprecated( + 'This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') + Future updateMagicURLSession( + {required String userId, required String secret}) async { + final String apiPath = '/account/sessions/magic-url'; final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. - @Deprecated('This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') - Future updatePhoneSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/phone'; + @Deprecated( + 'This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.') + Future updatePhoneSession( + {required String userId, required String secret}) async { + final String apiPath = '/account/sessions/phone'; final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Use this endpoint to create a session from token. Provide the **userId** /// and **secret** parameters from the successful response of authentication /// flows initiated by token creation. For example, magic URL and phone login. - Future createSession({required String userId, required String secret}) async { - final String apiPath = '/account/sessions/token'; + Future createSession( + {required String userId, required String secret}) async { + final String apiPath = '/account/sessions/token'; final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Use this endpoint to get a logged in user's session using a Session ID. /// Inputting 'current' will return the current session being used. - Future getSession({required String sessionId}) async { - final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); + Future getSession({required String sessionId}) async { + final String apiPath = + '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Use this endpoint to extend a session's length. Extending a session is /// useful when session expiry is short. If the session was created using an /// OAuth provider, this endpoint refreshes the access token from the provider. - Future updateSession({required String sessionId}) async { - final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); + Future updateSession({required String sessionId}) async { + final String apiPath = + '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Logout the user. Use 'current' as the session ID to logout on this device, /// use a session ID to logout on another device. If you're looking to logout /// the user on all devices, use [Delete /// Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) /// instead. - Future deleteSession({required String sessionId}) async { - final String apiPath = '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); + Future deleteSession({required String sessionId}) async { + final String apiPath = + '/account/sessions/{sessionId}'.replaceAll('{sessionId}', sessionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Block the currently logged in user account. Behind the scene, the user /// record is not deleted but permanently blocked from any access. To /// completely delete a user, use the Users API instead. - Future updateStatus() async { - final String apiPath = '/account/status'; + Future updateStatus() async { + final String apiPath = '/account/status'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Sends the user an email with a secret key for creating a session. If the /// email address has never been used, a **new account is created** using the @@ -1045,32 +926,30 @@ if (oldPassword != null) 'oldPassword': oldPassword, /// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. The secret sent to the user's email /// is valid for 15 minutes. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - /// - Future createEmailToken({required String userId, required String email, bool? phrase}) async { - final String apiPath = '/account/tokens/email'; + /// + Future createEmailToken( + {required String userId, required String email, bool? phrase}) async { + final String apiPath = '/account/tokens/email'; final Map apiParams = { - 'userId': userId, -'email': email, -if (phrase != null) 'phrase': phrase, - + 'email': email, + if (phrase != null) 'phrase': phrase, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Sends the user an email with a secret key for creating a session. If the /// provided user ID has not been registered, a new user will be created. When @@ -1081,57 +960,61 @@ if (phrase != null) 'phrase': phrase, /// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. The link sent to the user's email /// address is valid for 1 hour. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - /// - Future createMagicURLToken({required String userId, required String email, String? url, bool? phrase}) async { - final String apiPath = '/account/tokens/magic-url'; + /// + Future createMagicURLToken( + {required String userId, + required String email, + String? url, + bool? phrase}) async { + final String apiPath = '/account/tokens/magic-url'; final Map apiParams = { - 'userId': userId, -'email': email, -if (url != null) 'url': url, -if (phrase != null) 'phrase': phrase, - + 'email': email, + if (url != null) 'url': url, + if (phrase != null) 'phrase': phrase, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Allow the user to login to their account using the OAuth2 provider of their /// choice. Each OAuth2 provider should be enabled from the Appwrite console /// first. Use the success and failure arguments to provide a redirect URL's - /// back to your app when login is completed. - /// + /// back to your app when login is completed. + /// /// If authentication succeeds, `userId` and `secret` of a token will be /// appended to the success URL as query parameters. These can be used to /// create a new session using the [Create /// session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - Future createOAuth2Token({required enums.OAuthProvider provider, String? success, String? failure, List? scopes}) async { - final String apiPath = '/account/tokens/oauth2/{provider}'.replaceAll('{provider}', provider.value); + Future createOAuth2Token( + {required enums.OAuthProvider provider, + String? success, + String? failure, + List? scopes}) async { + final String apiPath = '/account/tokens/oauth2/{provider}' + .replaceAll('{provider}', provider.value); final Map params = { if (success != null) 'success': success, -if (failure != null) 'failure': failure, -if (scopes != null) 'scopes': scopes, - - + if (failure != null) 'failure': failure, + if (scopes != null) 'scopes': scopes, 'project': client.config['project'], 'session': client.config['session'], }; @@ -1139,7 +1022,7 @@ if (scopes != null) 'scopes': scopes, final List query = []; params.forEach((key, value) { - if (value is List) { + if (value is List) { for (var item in value) { query.add( '${Uri.encodeComponent('$key[]')}=${Uri.encodeComponent(item)}'); @@ -1150,15 +1033,15 @@ if (scopes != null) 'scopes': scopes, }); Uri endpoint = Uri.parse(client.endPoint); - Uri url = Uri(scheme: endpoint.scheme, - host: endpoint.host, - port: endpoint.port, - path: endpoint.path + apiPath, - query: query.join('&') - ); + Uri url = Uri( + scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + apiPath, + query: query.join('&')); return client.webAuth(url); - } + } /// Sends the user an SMS with a secret key for creating a session. If the /// provided user ID has not be registered, a new user will be created. Use the @@ -1166,30 +1049,28 @@ if (scopes != null) 'scopes': scopes, /// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. The secret sent to the user's phone /// is valid for 15 minutes. - /// + /// /// A user is limited to 10 active sessions at a time by default. [Learn more /// about session /// limits](https://appwrite.io/docs/authentication-security#limits). - Future createPhoneToken({required String userId, required String phone}) async { - final String apiPath = '/account/tokens/phone'; + Future createPhoneToken( + {required String userId, required String phone}) async { + final String apiPath = '/account/tokens/phone'; final Map apiParams = { - 'userId': userId, -'phone': phone, - + 'phone': phone, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to send a verification message to your user email address /// to confirm they are the valid owners of that address. Both the **userId** @@ -1200,31 +1081,28 @@ if (scopes != null) 'scopes': scopes, /// parameters. Learn more about how to [complete the verification /// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). /// The verification link sent to the user's email address is valid for 7 days. - /// + /// /// Please note that in order to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - /// - Future createEmailVerification({required String url}) async { - final String apiPath = '/account/verifications/email'; + /// + Future createEmailVerification({required String url}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { - 'url': url, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to send a verification message to your user email address /// to confirm they are the valid owners of that address. Both the **userId** @@ -1235,83 +1113,78 @@ if (scopes != null) 'scopes': scopes, /// parameters. Learn more about how to [complete the verification /// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). /// The verification link sent to the user's email address is valid for 7 days. - /// + /// /// Please note that in order to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), /// the only valid redirect URLs are the ones from domains you have set when /// adding your platforms in the console interface. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.') - Future createVerification({required String url}) async { - final String apiPath = '/account/verifications/email'; + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.') + Future createVerification({required String url}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { - 'url': url, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to complete the user email verification process. Use both /// the **userId** and **secret** parameters that were attached to your app URL /// to verify the user email ownership. If confirmed this route will return a /// 200 status code. - Future updateEmailVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verifications/email'; + Future updateEmailVerification( + {required String userId, required String secret}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to complete the user email verification process. Use both /// the **userId** and **secret** parameters that were attached to your app URL /// to verify the user email ownership. If confirmed this route will return a /// 200 status code. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.') - Future updateVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verifications/email'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.') + Future updateVerification( + {required String userId, required String secret}) async { + final String apiPath = '/account/verifications/email'; final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to send a verification SMS to the currently logged in /// user. This endpoint is meant for use after updating a user's phone number @@ -1321,47 +1194,41 @@ if (scopes != null) 'scopes': scopes, /// process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). /// The verification code sent to the user's phone number is valid for 15 /// minutes. - Future createPhoneVerification() async { - final String apiPath = '/account/verifications/phone'; + Future createPhoneVerification() async { + final String apiPath = '/account/verifications/phone'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Use this endpoint to complete the user phone verification process. Use the /// **userId** and **secret** that were sent to your user's phone number to /// verify the user email ownership. If confirmed this route will return a 200 /// status code. - Future updatePhoneVerification({required String userId, required String secret}) async { - final String apiPath = '/account/verifications/phone'; + Future updatePhoneVerification( + {required String userId, required String secret}) async { + final String apiPath = '/account/verifications/phone'; final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } } diff --git a/lib/services/activities.dart b/lib/services/activities.dart index 304d8166..90d6f639 100644 --- a/lib/services/activities.dart +++ b/lib/services/activities.dart @@ -1,45 +1,37 @@ part of '../dart_appwrite.dart'; class Activities extends Service { - Activities(super.client); + Activities(super.client); /// List all events for selected filters. - Future listEvents({String? queries}) async { - final String apiPath = '/activities/events'; + Future listEvents({String? queries}) async { + final String apiPath = '/activities/events'; final Map apiParams = { if (queries != null) 'queries': queries, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ActivityEventList.fromMap(res.data); - - } + } /// Get event by ID. - /// - Future getEvent({required String eventId}) async { - final String apiPath = '/activities/events/{eventId}'.replaceAll('{eventId}', eventId); + /// + Future getEvent({required String eventId}) async { + final String apiPath = + '/activities/events/{eventId}'.replaceAll('{eventId}', eventId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ActivityEvent.fromMap(res.data); - - } + } } diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index 7f69beb1..ee09c4bf 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -1,233 +1,261 @@ part of '../dart_appwrite.dart'; - /// The Avatars service aims to help you complete everyday tasks related to - /// your app image, icons, and avatars. +/// The Avatars service aims to help you complete everyday tasks related to +/// your app image, icons, and avatars. class Avatars extends Service { - Avatars(super.client); + Avatars(super.client); /// You can use this endpoint to show different browser icons to your users. /// The code argument receives the browser code as it appears in your user [GET /// /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) /// endpoint. Use width, height and quality arguments to change the output /// settings. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - Future getBrowser({required enums.Browser code, int? width, int? height, int? quality}) async { - final String apiPath = '/avatars/browsers/{code}'.replaceAll('{code}', code.value); + Future getBrowser( + {required enums.Browser code, + int? width, + int? height, + int? quality}) async { + final String apiPath = + '/avatars/browsers/{code}'.replaceAll('{code}', code.value); final Map params = { if (width != null) 'width': width, -if (height != null) 'height': height, -if (quality != null) 'quality': quality, - - + if (height != null) 'height': height, + if (quality != null) 'quality': quality, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// The credit card endpoint will return you the icon of the credit card /// provider you need. Use width, height and quality arguments to change the /// output settings. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// - Future getCreditCard({required enums.CreditCard code, int? width, int? height, int? quality}) async { - final String apiPath = '/avatars/credit-cards/{code}'.replaceAll('{code}', code.value); + /// + Future getCreditCard( + {required enums.CreditCard code, + int? width, + int? height, + int? quality}) async { + final String apiPath = + '/avatars/credit-cards/{code}'.replaceAll('{code}', code.value); final Map params = { if (width != null) 'width': width, -if (height != null) 'height': height, -if (quality != null) 'quality': quality, - - + if (height != null) 'height': height, + if (quality != null) 'quality': quality, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote /// website URL. - /// + /// /// This endpoint does not follow HTTP redirects. - Future getFavicon({required String url}) async { - final String apiPath = '/avatars/favicon'; + Future getFavicon({required String url}) async { + final String apiPath = '/avatars/favicon'; final Map params = { 'url': url, - - 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// You can use this endpoint to show different country flags icons to your /// users. The code argument receives the 2 letter country code. Use width, /// height and quality arguments to change the output settings. Country codes /// follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// - Future getFlag({required enums.Flag code, int? width, int? height, int? quality}) async { - final String apiPath = '/avatars/flags/{code}'.replaceAll('{code}', code.value); + /// + Future getFlag( + {required enums.Flag code, int? width, int? height, int? quality}) async { + final String apiPath = + '/avatars/flags/{code}'.replaceAll('{code}', code.value); final Map params = { if (width != null) 'width': width, -if (height != null) 'height': height, -if (quality != null) 'quality': quality, - - + if (height != null) 'height': height, + if (quality != null) 'quality': quality, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to fetch a remote image URL and crop it to any image size /// you want. This endpoint is very useful if you need to crop and display /// remote images in your app or in case you want to make sure a 3rd party /// image is properly served using a TLS protocol. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 400x400px. - /// + /// /// This endpoint does not follow HTTP redirects. - Future getImage({required String url, int? width, int? height}) async { - final String apiPath = '/avatars/image'; + Future getImage( + {required String url, int? width, int? height}) async { + final String apiPath = '/avatars/image'; final Map params = { 'url': url, -if (width != null) 'width': width, -if (height != null) 'height': height, - - + if (width != null) 'width': width, + if (height != null) 'height': height, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to show your user initials avatar icon on your website or /// app. By default, this route will try to print your logged-in user name or /// email initials. You can also overwrite the user name if you pass the 'name' /// parameter. If no name is given and no user is logged, an empty avatar will /// be returned. - /// + /// /// You can use the color and background params to change the avatar colors. By /// default, a random theme will be selected. The random theme will persist for /// the user's initials when reloading the same theme will always return for /// the same initials. - /// + /// /// When one dimension is specified and the other is 0, the image is scaled /// with preserved aspect ratio. If both dimensions are 0, the API provides an /// image at source quality. If dimensions are not specified, the default size /// of image returned is 100x100px. - /// - Future getInitials({String? name, int? width, int? height, String? background}) async { - final String apiPath = '/avatars/initials'; + /// + Future getInitials( + {String? name, int? width, int? height, String? background}) async { + final String apiPath = '/avatars/initials'; final Map params = { if (name != null) 'name': name, -if (width != null) 'width': width, -if (height != null) 'height': height, -if (background != null) 'background': background, - - + if (width != null) 'width': width, + if (height != null) 'height': height, + if (background != null) 'background': background, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Converts a given plain text to a QR code image. You can use the query /// parameters to change the size and style of the resulting image. - /// - Future getQR({required String text, int? size, int? margin, bool? download}) async { - final String apiPath = '/avatars/qr'; + /// + Future getQR( + {required String text, int? size, int? margin, bool? download}) async { + final String apiPath = '/avatars/qr'; final Map params = { 'text': text, -if (size != null) 'size': size, -if (margin != null) 'margin': margin, -if (download != null) 'download': download, - - + if (size != null) 'size': size, + if (margin != null) 'margin': margin, + if (download != null) 'download': download, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Use this endpoint to capture a screenshot of any website URL. This endpoint /// uses a headless browser to render the webpage and capture it as an image. - /// + /// /// You can configure the browser viewport size, theme, user agent, /// geolocation, permissions, and more. Capture either just the viewport or the /// full page scroll. - /// + /// /// When width and height are specified, the image is resized accordingly. If /// both dimensions are 0, the API provides an image at original size. If /// dimensions are not specified, the default viewport size is 1280x720px. - Future getScreenshot({required String url, Map? headers, int? viewportWidth, int? viewportHeight, double? scale, enums.Theme? theme, String? userAgent, bool? fullpage, String? locale, enums.Timezone? timezone, double? latitude, double? longitude, double? accuracy, bool? touch, List? permissions, int? sleep, int? width, int? height, int? quality, enums.ImageFormat? output}) async { - final String apiPath = '/avatars/screenshots'; + Future getScreenshot( + {required String url, + Map? headers, + int? viewportWidth, + int? viewportHeight, + double? scale, + enums.Theme? theme, + String? userAgent, + bool? fullpage, + String? locale, + enums.Timezone? timezone, + double? latitude, + double? longitude, + double? accuracy, + bool? touch, + List? permissions, + int? sleep, + int? width, + int? height, + int? quality, + enums.ImageFormat? output}) async { + final String apiPath = '/avatars/screenshots'; final Map params = { 'url': url, -if (headers != null) 'headers': headers, -if (viewportWidth != null) 'viewportWidth': viewportWidth, -if (viewportHeight != null) 'viewportHeight': viewportHeight, -if (scale != null) 'scale': scale, -if (theme != null) 'theme': theme.value, -if (userAgent != null) 'userAgent': userAgent, -if (fullpage != null) 'fullpage': fullpage, -if (locale != null) 'locale': locale, -if (timezone != null) 'timezone': timezone.value, -if (latitude != null) 'latitude': latitude, -if (longitude != null) 'longitude': longitude, -if (accuracy != null) 'accuracy': accuracy, -if (touch != null) 'touch': touch, -if (permissions != null) 'permissions': permissions.map((e) => e.value).toList(), -if (sleep != null) 'sleep': sleep, -if (width != null) 'width': width, -if (height != null) 'height': height, -if (quality != null) 'quality': quality, -if (output != null) 'output': output.value, - - + if (headers != null) 'headers': headers, + if (viewportWidth != null) 'viewportWidth': viewportWidth, + if (viewportHeight != null) 'viewportHeight': viewportHeight, + if (scale != null) 'scale': scale, + if (theme != null) 'theme': theme.value, + if (userAgent != null) 'userAgent': userAgent, + if (fullpage != null) 'fullpage': fullpage, + if (locale != null) 'locale': locale, + if (timezone != null) 'timezone': timezone.value, + if (latitude != null) 'latitude': latitude, + if (longitude != null) 'longitude': longitude, + if (accuracy != null) 'accuracy': accuracy, + if (touch != null) 'touch': touch, + if (permissions != null) + 'permissions': permissions.map((e) => e.value).toList(), + if (sleep != null) 'sleep': sleep, + if (width != null) 'width': width, + if (height != null) 'height': height, + if (quality != null) 'quality': quality, + if (output != null) 'output': output.value, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } } diff --git a/lib/services/backups.dart b/lib/services/backups.dart index adcd61e2..ba1e2dd9 100644 --- a/lib/services/backups.dart +++ b/lib/services/backups.dart @@ -1,259 +1,238 @@ part of '../dart_appwrite.dart'; class Backups extends Service { - Backups(super.client); + Backups(super.client); /// List all archives for a project. - Future listArchives({List? queries}) async { - final String apiPath = '/backups/archives'; + Future listArchives({List? queries}) async { + final String apiPath = '/backups/archives'; final Map apiParams = { if (queries != null) 'queries': queries, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupArchiveList.fromMap(res.data); - - } + } /// Create a new archive asynchronously for a project. - Future createArchive({required List services, String? resourceId}) async { - final String apiPath = '/backups/archives'; + Future createArchive( + {required List services, + String? resourceId}) async { + final String apiPath = '/backups/archives'; final Map apiParams = { - 'services': services.map((e) => e.value).toList(), -'resourceId': resourceId, - + 'resourceId': resourceId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupArchive.fromMap(res.data); - - } + } /// Get a backup archive using it's ID. - Future getArchive({required String archiveId}) async { - final String apiPath = '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); + Future getArchive({required String archiveId}) async { + final String apiPath = + '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupArchive.fromMap(res.data); - - } + } /// Delete an existing archive for a project. - Future deleteArchive({required String archiveId}) async { - final String apiPath = '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); + Future deleteArchive({required String archiveId}) async { + final String apiPath = + '/backups/archives/{archiveId}'.replaceAll('{archiveId}', archiveId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// List all policies for a project. - Future listPolicies({List? queries}) async { - final String apiPath = '/backups/policies'; + Future listPolicies({List? queries}) async { + final String apiPath = '/backups/policies'; final Map apiParams = { if (queries != null) 'queries': queries, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicyList.fromMap(res.data); - - } + } /// Create a new backup policy. - Future createPolicy({required String policyId, required List services, required int retention, required String schedule, String? name, String? resourceId, bool? enabled}) async { - final String apiPath = '/backups/policies'; + Future createPolicy( + {required String policyId, + required List services, + required int retention, + required String schedule, + String? name, + String? resourceId, + bool? enabled}) async { + final String apiPath = '/backups/policies'; final Map apiParams = { - 'policyId': policyId, -if (name != null) 'name': name, -'services': services.map((e) => e.value).toList(), -'resourceId': resourceId, -if (enabled != null) 'enabled': enabled, -'retention': retention, -'schedule': schedule, - + if (name != null) 'name': name, + 'services': services.map((e) => e.value).toList(), + 'resourceId': resourceId, + if (enabled != null) 'enabled': enabled, + 'retention': retention, + 'schedule': schedule, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicy.fromMap(res.data); - - } + } /// Get a backup policy using it's ID. - Future getPolicy({required String policyId}) async { - final String apiPath = '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); + Future getPolicy({required String policyId}) async { + final String apiPath = + '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicy.fromMap(res.data); - - } + } /// Update an existing policy using it's ID. - Future updatePolicy({required String policyId, String? name, int? retention, String? schedule, bool? enabled}) async { - final String apiPath = '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); + Future updatePolicy( + {required String policyId, + String? name, + int? retention, + String? schedule, + bool? enabled}) async { + final String apiPath = + '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); final Map apiParams = { - 'name': name, -'retention': retention, -if (schedule != null) 'schedule': schedule, -'enabled': enabled, - + 'retention': retention, + if (schedule != null) 'schedule': schedule, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupPolicy.fromMap(res.data); - - } + } /// Delete a policy using it's ID. - Future deletePolicy({required String policyId}) async { - final String apiPath = '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); + Future deletePolicy({required String policyId}) async { + final String apiPath = + '/backups/policies/{policyId}'.replaceAll('{policyId}', policyId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Create and trigger a new restoration for a backup on a project. - Future createRestoration({required String archiveId, required List services, String? newResourceId, String? newResourceName}) async { - final String apiPath = '/backups/restoration'; + Future createRestoration( + {required String archiveId, + required List services, + String? newResourceId, + String? newResourceName}) async { + final String apiPath = '/backups/restoration'; final Map apiParams = { - 'archiveId': archiveId, -'services': services.map((e) => e.value).toList(), -if (newResourceId != null) 'newResourceId': newResourceId, -if (newResourceName != null) 'newResourceName': newResourceName, - + 'services': services.map((e) => e.value).toList(), + if (newResourceId != null) 'newResourceId': newResourceId, + if (newResourceName != null) 'newResourceName': newResourceName, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupRestoration.fromMap(res.data); - - } + } /// List all backup restorations for a project. - Future listRestorations({List? queries}) async { - final String apiPath = '/backups/restorations'; + Future listRestorations( + {List? queries}) async { + final String apiPath = '/backups/restorations'; final Map apiParams = { if (queries != null) 'queries': queries, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupRestorationList.fromMap(res.data); - - } + } /// Get the current status of a backup restoration. - Future getRestoration({required String restorationId}) async { - final String apiPath = '/backups/restorations/{restorationId}'.replaceAll('{restorationId}', restorationId); + Future getRestoration( + {required String restorationId}) async { + final String apiPath = '/backups/restorations/{restorationId}' + .replaceAll('{restorationId}', restorationId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BackupRestoration.fromMap(res.data); - - } + } } diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 37c287c9..1fd2b527 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -1,1358 +1,1643 @@ part of '../dart_appwrite.dart'; - /// The Databases service allows you to create structured collections of - /// documents, query and filter lists of documents +/// The Databases service allows you to create structured collections of +/// documents, query and filter lists of documents class Databases extends Service { - Databases(super.client); + Databases(super.client); /// Get a list of all databases from the current Appwrite project. You can use /// the search parameter to filter your results. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead.') - Future list({List? queries, String? search, bool? total}) async { - final String apiPath = '/databases'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead.') + Future list( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/databases'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DatabaseList.fromMap(res.data); - - } + } /// Create a new Database. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead.') - Future create({required String databaseId, required String name, bool? enabled}) async { - final String apiPath = '/databases'; + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead.') + Future create( + {required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/databases'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -if (enabled != null) 'enabled': enabled, - + 'name': name, + if (enabled != null) 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - - } + } /// List transactions across all databases. - Future listTransactions({List? queries}) async { - final String apiPath = '/databases/transactions'; + Future listTransactions( + {List? queries}) async { + final String apiPath = '/databases/transactions'; final Map apiParams = { if (queries != null) 'queries': queries, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TransactionList.fromMap(res.data); - - } + } /// Create a new transaction. - Future createTransaction({int? ttl}) async { - final String apiPath = '/databases/transactions'; + Future createTransaction({int? ttl}) async { + final String apiPath = '/databases/transactions'; final Map apiParams = { - if (ttl != null) 'ttl': ttl, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Get a transaction by its unique ID. - Future getTransaction({required String transactionId}) async { - final String apiPath = '/databases/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); + Future getTransaction( + {required String transactionId}) async { + final String apiPath = '/databases/transactions/{transactionId}' + .replaceAll('{transactionId}', transactionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Update a transaction, to either commit or roll back its operations. - Future updateTransaction({required String transactionId, bool? commit, bool? rollback}) async { - final String apiPath = '/databases/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); + Future updateTransaction( + {required String transactionId, bool? commit, bool? rollback}) async { + final String apiPath = '/databases/transactions/{transactionId}' + .replaceAll('{transactionId}', transactionId); final Map apiParams = { - if (commit != null) 'commit': commit, -if (rollback != null) 'rollback': rollback, - + if (rollback != null) 'rollback': rollback, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Delete a transaction by its unique ID. - Future deleteTransaction({required String transactionId}) async { - final String apiPath = '/databases/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); + Future deleteTransaction({required String transactionId}) async { + final String apiPath = '/databases/transactions/{transactionId}' + .replaceAll('{transactionId}', transactionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Create multiple operations in a single transaction. - Future createOperations({required String transactionId, List? operations}) async { - final String apiPath = '/databases/transactions/{transactionId}/operations'.replaceAll('{transactionId}', transactionId); + Future createOperations( + {required String transactionId, List? operations}) async { + final String apiPath = '/databases/transactions/{transactionId}/operations' + .replaceAll('{transactionId}', transactionId); final Map apiParams = { - if (operations != null) 'operations': operations, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Get a database by its unique ID. This endpoint response returns a JSON /// object with the database metadata. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead.') - Future get({required String databaseId}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead.') + Future get({required String databaseId}) async { + final String apiPath = + '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - - } + } /// Update a database by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') - Future update({required String databaseId, String? name, bool? enabled}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.') + Future update( + {required String databaseId, String? name, bool? enabled}) async { + final String apiPath = + '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); final Map apiParams = { - if (name != null) 'name': name, -if (enabled != null) 'enabled': enabled, - + if (enabled != null) 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - - } + } /// Delete a database by its unique ID. Only API keys with with databases.write /// scope can delete a database. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead.') - Future delete({required String databaseId}) async { - final String apiPath = '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead.') + Future delete({required String databaseId}) async { + final String apiPath = + '/databases/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all collections that belong to the provided databaseId. You /// can use the search parameter to filter your results. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead.') - Future listCollections({required String databaseId, List? queries, String? search, bool? total}) async { - final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead.') + Future listCollections( + {required String databaseId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = '/databases/{databaseId}/collections' + .replaceAll('{databaseId}', databaseId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.CollectionList.fromMap(res.data); - - } + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead.') - Future createCollection({required String databaseId, required String collectionId, required String name, List? permissions, bool? documentSecurity, bool? enabled, List? attributes, List? indexes}) async { - final String apiPath = '/databases/{databaseId}/collections'.replaceAll('{databaseId}', databaseId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead.') + Future createCollection( + {required String databaseId, + required String collectionId, + required String name, + List? permissions, + bool? documentSecurity, + bool? enabled, + List? attributes, + List? indexes}) async { + final String apiPath = '/databases/{databaseId}/collections' + .replaceAll('{databaseId}', databaseId); final Map apiParams = { - 'collectionId': collectionId, -'name': name, -'permissions': permissions, -if (documentSecurity != null) 'documentSecurity': documentSecurity, -if (enabled != null) 'enabled': enabled, -if (attributes != null) 'attributes': attributes, -if (indexes != null) 'indexes': indexes, - + 'name': name, + 'permissions': permissions, + if (documentSecurity != null) 'documentSecurity': documentSecurity, + if (enabled != null) 'enabled': enabled, + if (attributes != null) 'attributes': attributes, + if (indexes != null) 'indexes': indexes, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Collection.fromMap(res.data); - - } + } /// Get a collection by its unique ID. This endpoint response returns a JSON /// object with the collection metadata. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead.') - Future getCollection({required String databaseId, required String collectionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead.') + Future getCollection( + {required String databaseId, required String collectionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Collection.fromMap(res.data); - - } + } /// Update a collection by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead.') - Future updateCollection({required String databaseId, required String collectionId, String? name, List? permissions, bool? documentSecurity, bool? enabled, bool? purge}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead.') + Future updateCollection( + {required String databaseId, + required String collectionId, + String? name, + List? permissions, + bool? documentSecurity, + bool? enabled, + bool? purge}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - if (name != null) 'name': name, -'permissions': permissions, -if (documentSecurity != null) 'documentSecurity': documentSecurity, -if (enabled != null) 'enabled': enabled, -if (purge != null) 'purge': purge, - + 'permissions': permissions, + if (documentSecurity != null) 'documentSecurity': documentSecurity, + if (enabled != null) 'enabled': enabled, + if (purge != null) 'purge': purge, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Collection.fromMap(res.data); - - } + } /// Delete a collection by its unique ID. Only users with write permissions /// have access to delete this resource. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead.') - Future deleteCollection({required String databaseId, required String collectionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead.') + Future deleteCollection( + {required String databaseId, required String collectionId}) async { + final String apiPath = '/databases/{databaseId}/collections/{collectionId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// List attributes in the collection. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead.') - Future listAttributes({required String databaseId, required String collectionId, List? queries, bool? total}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead.') + Future listAttributes( + {required String databaseId, + required String collectionId, + List? queries, + bool? total}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeList.fromMap(res.data); - - } + } /// Create a bigint attribute. Optionally, minimum and maximum values can be /// provided. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead.') - Future createBigIntAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead.') + Future createBigIntAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + int? min, + int? max, + int? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeBigint.fromMap(res.data); - - } + } /// Update a bigint attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead.') - Future updateBigIntAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead.') + Future updateBigIntAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required int? xdefault, + int? min, + int? max, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'newKey': newKey, - + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeBigint.fromMap(res.data); - - } + } /// Create a boolean attribute. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead.') - Future createBooleanAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, bool? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead.') + Future createBooleanAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + bool? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeBoolean.fromMap(res.data); - - } + } /// Update a boolean attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead.') - Future updateBooleanAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required bool? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead.') + Future updateBooleanAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required bool? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeBoolean.fromMap(res.data); - - } + } /// Create a date time attribute according to the ISO 8601 standard. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead.') - Future createDatetimeAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead.') + Future createDatetimeAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeDatetime.fromMap(res.data); - - } + } /// Update a date time attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead.') - Future updateDatetimeAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead.') + Future updateDatetimeAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeDatetime.fromMap(res.data); - - } + } /// Create an email attribute. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead.') - Future createEmailAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead.') + Future createEmailAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/email' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEmail.fromMap(res.data); - - } + } /// Update an email attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead.') - Future updateEmailAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead.') + Future updateEmailAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEmail.fromMap(res.data); - - } + } /// Create an enum attribute. The `elements` param acts as a white-list of - /// accepted values for this attribute. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead.') - Future createEnumAttribute({required String databaseId, required String collectionId, required String key, required List elements, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// accepted values for this attribute. + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead.') + Future createEnumAttribute( + {required String databaseId, + required String collectionId, + required String key, + required List elements, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/enum' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'elements': elements, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEnum.fromMap(res.data); - - } + } /// Update an enum attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead.') - Future updateEnumAttribute({required String databaseId, required String collectionId, required String key, required List elements, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead.') + Future updateEnumAttribute( + {required String databaseId, + required String collectionId, + required String key, + required List elements, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'elements': elements, -'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'required': xrequired, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeEnum.fromMap(res.data); - - } + } /// Create a float attribute. Optionally, minimum and maximum values can be /// provided. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead.') - Future createFloatAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, double? min, double? max, double? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead.') + Future createFloatAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + double? min, + double? max, + double? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/float' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeFloat.fromMap(res.data); - - } + } /// Update a float attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead.') - Future updateFloatAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required double? xdefault, double? min, double? max, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead.') + Future updateFloatAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required double? xdefault, + double? min, + double? max, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'newKey': newKey, - + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeFloat.fromMap(res.data); - - } + } /// Create an integer attribute. Optionally, minimum and maximum values can be /// provided. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead.') - Future createIntegerAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead.') + Future createIntegerAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + int? min, + int? max, + int? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/integer' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeInteger.fromMap(res.data); - - } + } /// Update an integer attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead.') - Future updateIntegerAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead.') + Future updateIntegerAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required int? xdefault, + int? min, + int? max, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'newKey': newKey, - + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeInteger.fromMap(res.data); - - } + } /// Create IP address attribute. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead.') - Future createIpAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead.') + Future createIpAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/ip' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeIp.fromMap(res.data); - - } + } /// Update an ip attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead.') - Future updateIpAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead.') + Future updateIpAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeIp.fromMap(res.data); - - } + } /// Create a geometric line attribute. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead.') - Future createLineAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead.') + Future createLineAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + List? xdefault}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/line' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, - + 'required': xrequired, + 'default': xdefault, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLine.fromMap(res.data); - - } + } /// Update a line attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead.') - Future updateLineAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead.') + Future updateLineAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + List? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLine.fromMap(res.data); - - } + } /// Create a longtext attribute. - /// - Future createLongtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + Future createLongtextAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/longtext' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLongtext.fromMap(res.data); - - } + } /// Update a longtext attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateLongtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + Future updateLongtextAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeLongtext.fromMap(res.data); - - } + } /// Create a mediumtext attribute. - /// - Future createMediumtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + Future createMediumtextAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeMediumtext.fromMap(res.data); - - } + } /// Update a mediumtext attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateMediumtextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + Future updateMediumtextAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeMediumtext.fromMap(res.data); - - } + } /// Create a geometric point attribute. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.') - Future createPointAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.') + Future createPointAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + List? xdefault}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/point' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, - + 'required': xrequired, + 'default': xdefault, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePoint.fromMap(res.data); - - } + } /// Update a point attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead.') - Future updatePointAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead.') + Future updatePointAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + List? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePoint.fromMap(res.data); - - } + } /// Create a geometric polygon attribute. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead.') - Future createPolygonAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead.') + Future createPolygonAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + List? xdefault}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/polygon' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, - + 'required': xrequired, + 'default': xdefault, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePolygon.fromMap(res.data); - - } + } /// Update a polygon attribute. Changing the `default` value will not update /// already existing documents. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead.') - Future updatePolygonAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead.') + Future updatePolygonAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + List? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributePolygon.fromMap(res.data); - - } + } /// Create relationship attribute. [Learn more about relationship /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead.') - Future createRelationshipAttribute({required String databaseId, required String collectionId, required String relatedCollectionId, required enums.RelationshipType type, bool? twoWay, String? key, String? twoWayKey, enums.RelationMutate? onDelete}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead.') + Future createRelationshipAttribute( + {required String databaseId, + required String collectionId, + required String relatedCollectionId, + required enums.RelationshipType type, + bool? twoWay, + String? key, + String? twoWayKey, + enums.RelationMutate? onDelete}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'relatedCollectionId': relatedCollectionId, -'type': type.value, -if (twoWay != null) 'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -if (onDelete != null) 'onDelete': onDelete.value, - + 'type': type.value, + if (twoWay != null) 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + if (onDelete != null) 'onDelete': onDelete.value, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeRelationship.fromMap(res.data); - - } + } /// Update relationship attribute. [Learn more about relationship /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.') - Future updateRelationshipAttribute({required String databaseId, required String collectionId, required String key, enums.RelationMutate? onDelete, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.') + Future updateRelationshipAttribute( + {required String databaseId, + required String collectionId, + required String key, + enums.RelationMutate? onDelete, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - if (onDelete != null) 'onDelete': onDelete.value, -'newKey': newKey, - + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeRelationship.fromMap(res.data); - - } + } /// Create a string attribute. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead.') - Future createStringAttribute({required String databaseId, required String collectionId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead.') + Future createStringAttribute( + {required String databaseId, + required String collectionId, + required String key, + required int size, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/string' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'size': size, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeString.fromMap(res.data); - - } + } /// Update a string attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead.') - Future updateStringAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead.') + Future updateStringAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + int? size, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'size': size, -'newKey': newKey, - + 'default': xdefault, + 'size': size, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeString.fromMap(res.data); - - } + } /// Create a text attribute. - /// - Future createTextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + Future createTextAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/text' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeText.fromMap(res.data); - - } + } /// Update a text attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateTextAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + Future updateTextAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeText.fromMap(res.data); - - } + } /// Create a URL attribute. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead.') - Future createUrlAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead.') + Future createUrlAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/url' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeUrl.fromMap(res.data); - - } + } /// Update an url attribute. Changing the `default` value will not update /// already existing documents. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead.') - Future updateUrlAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead.') + Future updateUrlAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeUrl.fromMap(res.data); - - } + } /// Create a varchar attribute. - /// - Future createVarcharAttribute({required String databaseId, required String collectionId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + Future createVarcharAttribute( + {required String databaseId, + required String collectionId, + required String key, + required int size, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'size': size, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeVarchar.fromMap(res.data); - - } + } /// Update a varchar attribute. Changing the `default` value will not update /// already existing documents. - /// - Future updateVarcharAttribute({required String databaseId, required String collectionId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + /// + Future updateVarcharAttribute( + {required String databaseId, + required String collectionId, + required String key, + required bool xrequired, + required String? xdefault, + int? size, + String? newKey}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'size': size, -'newKey': newKey, - + 'default': xdefault, + 'size': size, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.AttributeVarchar.fromMap(res.data); - - } + } /// Get attribute by ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead.') - Future getAttribute({required String databaseId, required String collectionId, required String key}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead.') + Future getAttribute( + {required String databaseId, + required String collectionId, + required String key}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -1387,421 +1672,526 @@ if (encrypt != null) 'encrypt': encrypt, return models.AttributeString.fromMap(response); } - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); }(); - - } + } /// Deletes an attribute. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead.') - Future deleteAttribute({required String databaseId, required String collectionId, required String key}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead.') + Future deleteAttribute( + {required String databaseId, + required String collectionId, + required String key}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all the user's documents in a given collection. You can use /// the query params to filter your results. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.') - Future listDocuments({required String databaseId, required String collectionId, List? queries, String? transactionId, bool? total, int? ttl}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.') + Future listDocuments( + {required String databaseId, + required String collectionId, + List? queries, + String? transactionId, + bool? total, + int? ttl}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { if (queries != null) 'queries': queries, -if (transactionId != null) 'transactionId': transactionId, -if (total != null) 'total': total, -if (ttl != null) 'ttl': ttl, - - + if (transactionId != null) 'transactionId': transactionId, + if (total != null) 'total': total, + if (ttl != null) 'ttl': ttl, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - - } + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead.') - Future createDocument({required String databaseId, required String collectionId, required String documentId, required Map data, List? permissions, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead.') + Future createDocument( + {required String databaseId, + required String collectionId, + required String documentId, + required Map data, + List? permissions, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documentId': documentId, -'data': data, -'permissions': permissions, -'transactionId': transactionId, - + 'data': data, + 'permissions': permissions, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - - } + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead.') - Future createDocuments({required String databaseId, required String collectionId, required List documents, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead.') + Future createDocuments( + {required String databaseId, + required String collectionId, + required List documents, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documents': documents, -'transactionId': transactionId, - + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - - } + } /// 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#databasesCreateCollection) /// API or directly from your database console. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.') - Future upsertDocuments({required String databaseId, required String collectionId, required List documents, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead.') + Future upsertDocuments( + {required String databaseId, + required String collectionId, + required List documents, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'documents': documents, -'transactionId': transactionId, - + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - - } + } /// 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. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead.') - Future updateDocuments({required String databaseId, required String collectionId, Map? data, List? queries, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead.') + Future updateDocuments( + {required String databaseId, + required String collectionId, + Map? data, + List? queries, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - if (data != null) 'data': data, -if (queries != null) 'queries': queries, -'transactionId': transactionId, - + if (queries != null) 'queries': queries, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - - } + } /// Bulk delete documents using queries, if no queries are passed then all /// documents are deleted. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead.') - Future deleteDocuments({required String databaseId, required String collectionId, List? queries, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead.') + Future deleteDocuments( + {required String databaseId, + required String collectionId, + List? queries, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - if (queries != null) 'queries': queries, -'transactionId': transactionId, - + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DocumentList.fromMap(res.data); - - } + } /// Get a document by its unique ID. This endpoint response returns a JSON /// object with the document data. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead.') - Future getDocument({required String databaseId, required String collectionId, required String documentId, List? queries, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead.') + Future getDocument( + {required String databaseId, + required String collectionId, + required String documentId, + List? queries, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { if (queries != null) 'queries': queries, -if (transactionId != null) 'transactionId': transactionId, - - + if (transactionId != null) 'transactionId': transactionId, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - - } + } /// 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#databasesCreateCollection) /// API or directly from your database console. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.') - Future upsertDocument({required String databaseId, required String collectionId, required String documentId, Map? data, List? permissions, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.') + Future upsertDocument( + {required String databaseId, + required String collectionId, + required String documentId, + Map? data, + List? permissions, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - if (data != null) 'data': data, -'permissions': permissions, -'transactionId': transactionId, - + 'permissions': permissions, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - - } + } /// Update a document by its unique ID. Using the patch method you can pass /// only specific fields that will get updated. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead.') - Future updateDocument({required String databaseId, required String collectionId, required String documentId, Map? data, List? permissions, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead.') + Future updateDocument( + {required String databaseId, + required String collectionId, + required String documentId, + Map? data, + List? permissions, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - if (data != null) 'data': data, -'permissions': permissions, -'transactionId': transactionId, - + 'permissions': permissions, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - - } + } /// Delete a document by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead.') - Future deleteDocument({required String databaseId, required String collectionId, required String documentId, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead.') + Future deleteDocument( + {required String databaseId, + required String collectionId, + required String documentId, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId); final Map apiParams = { - 'transactionId': transactionId, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Decrement a specific attribute of a document by a given value. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead.') - Future decrementDocumentAttribute({required String databaseId, required String collectionId, required String documentId, required String attribute, double? value, double? min, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId).replaceAll('{attribute}', attribute); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead.') + Future decrementDocumentAttribute( + {required String databaseId, + required String collectionId, + required String documentId, + required String attribute, + double? value, + double? min, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId) + .replaceAll('{attribute}', attribute); final Map apiParams = { - if (value != null) 'value': value, -'min': min, -'transactionId': transactionId, - + 'min': min, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - - } + } /// Increment a specific attribute of a document by a given value. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead.') - Future incrementDocumentAttribute({required String databaseId, required String collectionId, required String documentId, required String attribute, double? value, double? max, String? transactionId}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{documentId}', documentId).replaceAll('{attribute}', attribute); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead.') + Future incrementDocumentAttribute( + {required String databaseId, + required String collectionId, + required String documentId, + required String attribute, + double? value, + double? max, + String? transactionId}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{documentId}', documentId) + .replaceAll('{attribute}', attribute); final Map apiParams = { - if (value != null) 'value': value, -'max': max, -'transactionId': transactionId, - + 'max': max, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Document.fromMap(res.data); - - } + } /// List indexes in the collection. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead.') - Future listIndexes({required String databaseId, required String collectionId, List? queries, bool? total}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead.') + Future listIndexes( + {required String databaseId, + required String collectionId, + List? queries, + bool? total}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.IndexList.fromMap(res.data); - - } + } /// Creates an index on the attributes listed. Your index should include all /// the attributes you will query in a single request. /// Attributes can be `key`, `fulltext`, and `unique`. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead.') - Future createIndex({required String databaseId, required String collectionId, required String key, required enums.DatabasesIndexType type, required List attributes, List? orders, List? lengths}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead.') + Future createIndex( + {required String databaseId, + required String collectionId, + required String key, + required enums.DatabasesIndexType type, + required List attributes, + List? orders, + List? lengths}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId); final Map apiParams = { - 'key': key, -'type': type.value, -'attributes': attributes, -if (orders != null) 'orders': orders.map((e) => e.value).toList(), -if (lengths != null) 'lengths': lengths, - + 'type': type.value, + 'attributes': attributes, + if (orders != null) 'orders': orders.map((e) => e.value).toList(), + if (lengths != null) 'lengths': lengths, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Index.fromMap(res.data); - - } + } /// Get an index by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead.') - Future getIndex({required String databaseId, required String collectionId, required String key}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead.') + Future getIndex( + {required String databaseId, + required String collectionId, + required String key}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Index.fromMap(res.data); - - } + } /// Delete an index. - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead.') - Future deleteIndex({required String databaseId, required String collectionId, required String key}) async { - final String apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{collectionId}', collectionId).replaceAll('{key}', key); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead.') + Future deleteIndex( + {required String databaseId, + required String collectionId, + required String key}) async { + final String apiPath = + '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{collectionId}', collectionId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/functions.dart b/lib/services/functions.dart index caad5e38..01426171 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -1,262 +1,288 @@ part of '../dart_appwrite.dart'; - /// The Functions Service allows you view, create and manage your Cloud - /// Functions. +/// The Functions Service allows you view, create and manage your Cloud +/// Functions. class Functions extends Service { - Functions(super.client); + Functions(super.client); /// Get a list of all the project's functions. You can use the query params to /// filter your results. - Future list({List? queries, String? search, bool? total}) async { - final String apiPath = '/functions'; + Future list( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/functions'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.FunctionList.fromMap(res.data); - - } + } /// Create a new function. You can pass a list of /// [permissions](https://appwrite.io/docs/permissions) to allow different /// project users or team with access to execute the function using the client /// API. - Future create({required String functionId, required String name, required enums.Runtime runtime, List? execute, List? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, List? scopes, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { - final String apiPath = '/functions'; + Future create( + {required String functionId, + required String name, + required enums.Runtime runtime, + List? execute, + List? events, + String? schedule, + int? timeout, + bool? enabled, + bool? logging, + String? entrypoint, + String? commands, + List? scopes, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? buildSpecification, + String? runtimeSpecification, + int? deploymentRetention}) async { + final String apiPath = '/functions'; final Map apiParams = { - 'functionId': functionId, -'name': name, -'runtime': runtime.value, -if (execute != null) 'execute': execute, -if (events != null) 'events': events, -if (schedule != null) 'schedule': schedule, -if (timeout != null) 'timeout': timeout, -if (enabled != null) 'enabled': enabled, -if (logging != null) 'logging': logging, -if (entrypoint != null) 'entrypoint': entrypoint, -if (commands != null) 'commands': commands, -if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), -if (installationId != null) 'installationId': installationId, -if (providerRepositoryId != null) 'providerRepositoryId': providerRepositoryId, -if (providerBranch != null) 'providerBranch': providerBranch, -if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, -if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, -if (buildSpecification != null) 'buildSpecification': buildSpecification, -if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, -if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, - + 'name': name, + 'runtime': runtime.value, + if (execute != null) 'execute': execute, + if (events != null) 'events': events, + if (schedule != null) 'schedule': schedule, + if (timeout != null) 'timeout': timeout, + if (enabled != null) 'enabled': enabled, + if (logging != null) 'logging': logging, + if (entrypoint != null) 'entrypoint': entrypoint, + if (commands != null) 'commands': commands, + if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), + if (installationId != null) 'installationId': installationId, + if (providerRepositoryId != null) + 'providerRepositoryId': providerRepositoryId, + if (providerBranch != null) 'providerBranch': providerBranch, + if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, + if (providerRootDirectory != null) + 'providerRootDirectory': providerRootDirectory, + if (buildSpecification != null) 'buildSpecification': buildSpecification, + if (runtimeSpecification != null) + 'runtimeSpecification': runtimeSpecification, + if (deploymentRetention != null) + 'deploymentRetention': deploymentRetention, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - - } + } /// Get a list of all runtimes that are currently active on your instance. - Future listRuntimes() async { - final String apiPath = '/functions/runtimes'; + Future listRuntimes() async { + final String apiPath = '/functions/runtimes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.RuntimeList.fromMap(res.data); - - } + } /// List allowed function specifications for this instance. - Future listSpecifications() async { - final String apiPath = '/functions/specifications'; + Future listSpecifications() async { + final String apiPath = '/functions/specifications'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.SpecificationList.fromMap(res.data); - - } + } /// Get a function by its unique ID. - Future get({required String functionId}) async { - final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); + Future get({required String functionId}) async { + final String apiPath = + '/functions/{functionId}'.replaceAll('{functionId}', functionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - - } + } /// Update function by its unique ID. - Future update({required String functionId, required String name, enums.Runtime? runtime, List? execute, List? events, String? schedule, int? timeout, bool? enabled, bool? logging, String? entrypoint, String? commands, List? scopes, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { - final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); + Future update( + {required String functionId, + required String name, + enums.Runtime? runtime, + List? execute, + List? events, + String? schedule, + int? timeout, + bool? enabled, + bool? logging, + String? entrypoint, + String? commands, + List? scopes, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? buildSpecification, + String? runtimeSpecification, + int? deploymentRetention}) async { + final String apiPath = + '/functions/{functionId}'.replaceAll('{functionId}', functionId); final Map apiParams = { - 'name': name, -if (runtime != null) 'runtime': runtime.value, -if (execute != null) 'execute': execute, -if (events != null) 'events': events, -if (schedule != null) 'schedule': schedule, -if (timeout != null) 'timeout': timeout, -if (enabled != null) 'enabled': enabled, -if (logging != null) 'logging': logging, -if (entrypoint != null) 'entrypoint': entrypoint, -if (commands != null) 'commands': commands, -if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), -if (installationId != null) 'installationId': installationId, -'providerRepositoryId': providerRepositoryId, -if (providerBranch != null) 'providerBranch': providerBranch, -if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, -if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, -if (buildSpecification != null) 'buildSpecification': buildSpecification, -if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, -if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, - + if (runtime != null) 'runtime': runtime.value, + if (execute != null) 'execute': execute, + if (events != null) 'events': events, + if (schedule != null) 'schedule': schedule, + if (timeout != null) 'timeout': timeout, + if (enabled != null) 'enabled': enabled, + if (logging != null) 'logging': logging, + if (entrypoint != null) 'entrypoint': entrypoint, + if (commands != null) 'commands': commands, + if (scopes != null) 'scopes': scopes.map((e) => e.value).toList(), + if (installationId != null) 'installationId': installationId, + 'providerRepositoryId': providerRepositoryId, + if (providerBranch != null) 'providerBranch': providerBranch, + if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, + if (providerRootDirectory != null) + 'providerRootDirectory': providerRootDirectory, + if (buildSpecification != null) 'buildSpecification': buildSpecification, + if (runtimeSpecification != null) + 'runtimeSpecification': runtimeSpecification, + if (deploymentRetention != null) + 'deploymentRetention': deploymentRetention, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - - } + } /// Delete a function by its unique ID. - Future delete({required String functionId}) async { - final String apiPath = '/functions/{functionId}'.replaceAll('{functionId}', functionId); + Future delete({required String functionId}) async { + final String apiPath = + '/functions/{functionId}'.replaceAll('{functionId}', functionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update the function active deployment. Use this endpoint to switch the code /// deployment that should be used when visitor opens your function. - Future updateFunctionDeployment({required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployment'.replaceAll('{functionId}', functionId); + Future updateFunctionDeployment( + {required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployment' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'deploymentId': deploymentId, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Func.fromMap(res.data); - - } + } /// Get a list of all the function's code deployments. You can use the query /// params to filter your results. - Future listDeployments({required String functionId, List? queries, String? search, bool? total}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future listDeployments( + {required String functionId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = '/functions/{functionId}/deployments' + .replaceAll('{functionId}', functionId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DeploymentList.fromMap(res.data); - - } + } /// Create a new function code deployment. Use this endpoint to upload a new /// version of your code function. To execute your newly uploaded code, you'll /// need to update the function's deployment to use your new deployment UID. - /// + /// /// This endpoint accepts a tar.gz file compressed with your code. Make sure to /// include any dependencies your code has within the compressed file. You can /// learn more about code packaging in the [Appwrite Cloud Functions /// tutorial](https://appwrite.io/docs/functions). - /// + /// /// Use the "command" param to set the entrypoint used to execute your code. - Future createDeployment({required String functionId, required InputFile code, required bool activate, String? entrypoint, String? commands, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/functions/{functionId}/deployments'.replaceAll('{functionId}', functionId); + Future createDeployment( + {required String functionId, + required InputFile code, + required bool activate, + String? entrypoint, + String? commands, + Function(UploadProgress)? onProgress}) async { + final String apiPath = '/functions/{functionId}/deployments' + .replaceAll('{functionId}', functionId); final Map apiParams = { - if (entrypoint != null) 'entrypoint': entrypoint, -if (commands != null) 'commands': commands, -'code': code, -'activate': activate, - + if (commands != null) 'commands': commands, + 'code': code, + 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -271,366 +297,377 @@ if (commands != null) 'commands': commands, ); return models.Deployment.fromMap(res.data); - - } + } /// Create a new build for an existing function deployment. This endpoint /// allows you to rebuild a deployment with the updated function configuration, /// including its entrypoint and build commands if they have been modified. The /// build process will be queued and executed asynchronously. The original /// deployment's code will be preserved and used for the new build. - Future createDuplicateDeployment({required String functionId, required String deploymentId, String? buildId}) async { - final String apiPath = '/functions/{functionId}/deployments/duplicate'.replaceAll('{functionId}', functionId); + Future createDuplicateDeployment( + {required String functionId, + required String deploymentId, + String? buildId}) async { + final String apiPath = '/functions/{functionId}/deployments/duplicate' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'deploymentId': deploymentId, -if (buildId != null) 'buildId': buildId, - + if (buildId != null) 'buildId': buildId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Create a deployment based on a template. - /// + /// /// Use this endpoint with combination of /// [listTemplates](https://appwrite.io/docs/products/functions/templates) to /// find the template details. - Future createTemplateDeployment({required String functionId, required String repository, required String owner, required String rootDirectory, required enums.TemplateReferenceType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/template'.replaceAll('{functionId}', functionId); + Future createTemplateDeployment( + {required String functionId, + required String repository, + required String owner, + required String rootDirectory, + required enums.TemplateReferenceType type, + required String reference, + bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/template' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'type': type.value, -'reference': reference, -if (activate != null) 'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'type': type.value, + 'reference': reference, + if (activate != null) 'activate': activate, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Create a deployment when a function is connected to VCS. - /// + /// /// This endpoint lets you create deployment from a branch, commit, or a tag. - Future createVcsDeployment({required String functionId, required enums.VCSReferenceType type, required String reference, bool? activate}) async { - final String apiPath = '/functions/{functionId}/deployments/vcs'.replaceAll('{functionId}', functionId); + Future createVcsDeployment( + {required String functionId, + required enums.VCSReferenceType type, + required String reference, + bool? activate}) async { + final String apiPath = '/functions/{functionId}/deployments/vcs' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'type': type.value, -'reference': reference, -if (activate != null) 'activate': activate, - + 'reference': reference, + if (activate != null) 'activate': activate, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Get a function deployment by its unique ID. - Future getDeployment({required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); + Future getDeployment( + {required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Delete a code deployment by its unique ID. - Future deleteDeployment({required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); + Future deleteDeployment( + {required String functionId, required String deploymentId}) async { + final String apiPath = '/functions/{functionId}/deployments/{deploymentId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a function deployment content by its unique ID. The endpoint response /// return with a 'Content-Disposition: attachment' header that tells the /// browser to start downloading the file to user downloads directory. - Future getDeploymentDownload({required String functionId, required String deploymentId, enums.DeploymentDownloadType? type}) async { - final String apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); + Future getDeploymentDownload( + {required String functionId, + required String deploymentId, + enums.DeploymentDownloadType? type}) async { + final String apiPath = + '/functions/{functionId}/deployments/{deploymentId}/download' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); final Map params = { if (type != null) 'type': type.value, - - 'project': client.config['project'], 'key': client.config['key'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Cancel an ongoing function deployment build. If the build is already in /// progress, it will be stopped and marked as canceled. If the build hasn't /// started yet, it will be marked as canceled without executing. You cannot /// cancel builds that have already completed (status 'ready') or failed. The /// response includes the final build status and details. - Future updateDeploymentStatus({required String functionId, required String deploymentId}) async { - final String apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replaceAll('{functionId}', functionId).replaceAll('{deploymentId}', deploymentId); + Future updateDeploymentStatus( + {required String functionId, required String deploymentId}) async { + final String apiPath = + '/functions/{functionId}/deployments/{deploymentId}/status' + .replaceAll('{functionId}', functionId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Get a list of all the current user function execution logs. You can use the /// query params to filter your results. - Future listExecutions({required String functionId, List? queries, bool? total}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); + Future listExecutions( + {required String functionId, List? queries, bool? total}) async { + final String apiPath = '/functions/{functionId}/executions' + .replaceAll('{functionId}', functionId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ExecutionList.fromMap(res.data); - - } + } /// Trigger a function execution. The returned object will return you the /// current execution status. You can ping the `Get Execution` endpoint to get /// updates on the current execution status. Once this endpoint is called, your /// function execution process will start asynchronously. - Future createExecution({required String functionId, String? body, bool? xasync, String? path, enums.ExecutionMethod? method, Map? headers, String? scheduledAt}) async { - final String apiPath = '/functions/{functionId}/executions'.replaceAll('{functionId}', functionId); + Future createExecution( + {required String functionId, + String? body, + bool? xasync, + String? path, + enums.ExecutionMethod? method, + Map? headers, + String? scheduledAt}) async { + final String apiPath = '/functions/{functionId}/executions' + .replaceAll('{functionId}', functionId); final Map apiParams = { - if (body != null) 'body': body, -if (xasync != null) 'async': xasync, -if (path != null) 'path': path, -if (method != null) 'method': method.value, -if (headers != null) 'headers': headers, -'scheduledAt': scheduledAt, - + if (xasync != null) 'async': xasync, + if (path != null) 'path': path, + if (method != null) 'method': method.value, + if (headers != null) 'headers': headers, + 'scheduledAt': scheduledAt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Execution.fromMap(res.data); - - } + } /// Get a function execution log by its unique ID. - Future getExecution({required String functionId, required String executionId}) async { - final String apiPath = '/functions/{functionId}/executions/{executionId}'.replaceAll('{functionId}', functionId).replaceAll('{executionId}', executionId); + Future getExecution( + {required String functionId, required String executionId}) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Execution.fromMap(res.data); - - } + } /// Delete a function execution by its unique ID. - Future deleteExecution({required String functionId, required String executionId}) async { - final String apiPath = '/functions/{functionId}/executions/{executionId}'.replaceAll('{functionId}', functionId).replaceAll('{executionId}', executionId); + Future deleteExecution( + {required String functionId, required String executionId}) async { + final String apiPath = '/functions/{functionId}/executions/{executionId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{executionId}', executionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all variables of a specific function. - Future listVariables({required String functionId, List? queries, bool? total}) async { - final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); + Future listVariables( + {required String functionId, List? queries, bool? total}) async { + final String apiPath = '/functions/{functionId}/variables' + .replaceAll('{functionId}', functionId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.VariableList.fromMap(res.data); - - } + } /// Create a new function environment variable. These variables can be accessed /// in the function at runtime as environment variables. - Future createVariable({required String functionId, required String variableId, required String key, required String value, bool? secret}) async { - final String apiPath = '/functions/{functionId}/variables'.replaceAll('{functionId}', functionId); + Future createVariable( + {required String functionId, + required String variableId, + required String key, + required String value, + bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables' + .replaceAll('{functionId}', functionId); final Map apiParams = { - 'variableId': variableId, -'key': key, -'value': value, -if (secret != null) 'secret': secret, - + 'key': key, + 'value': value, + if (secret != null) 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Get a variable by its unique ID. - Future getVariable({required String functionId, required String variableId}) async { - final String apiPath = '/functions/{functionId}/variables/{variableId}'.replaceAll('{functionId}', functionId).replaceAll('{variableId}', variableId); + Future getVariable( + {required String functionId, required String variableId}) async { + final String apiPath = '/functions/{functionId}/variables/{variableId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{variableId}', variableId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Update variable by its unique ID. - Future updateVariable({required String functionId, required String variableId, String? key, String? value, bool? secret}) async { - final String apiPath = '/functions/{functionId}/variables/{variableId}'.replaceAll('{functionId}', functionId).replaceAll('{variableId}', variableId); + Future updateVariable( + {required String functionId, + required String variableId, + String? key, + String? value, + bool? secret}) async { + final String apiPath = '/functions/{functionId}/variables/{variableId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{variableId}', variableId); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Delete a variable by its unique ID. - Future deleteVariable({required String functionId, required String variableId}) async { - final String apiPath = '/functions/{functionId}/variables/{variableId}'.replaceAll('{functionId}', functionId).replaceAll('{variableId}', variableId); + Future deleteVariable( + {required String functionId, required String variableId}) async { + final String apiPath = '/functions/{functionId}/variables/{variableId}' + .replaceAll('{functionId}', functionId) + .replaceAll('{variableId}', variableId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/graphql.dart b/lib/services/graphql.dart index 7dd8a04d..f1275fd4 100644 --- a/lib/services/graphql.dart +++ b/lib/services/graphql.dart @@ -1,51 +1,45 @@ part of '../dart_appwrite.dart'; - /// The GraphQL API allows you to query and mutate your Appwrite server using - /// GraphQL. +/// The GraphQL API allows you to query and mutate your Appwrite server using +/// GraphQL. class Graphql extends Service { - Graphql(super.client); + Graphql(super.client); /// Execute a GraphQL mutation. - Future query({required Map query}) async { - final String apiPath = '/graphql'; + Future query({required Map query}) async { + final String apiPath = '/graphql'; final Map apiParams = { - 'query': query, - }; final Map apiHeaders = { 'x-sdk-graphql': 'true', -'content-type': 'application/json', - + 'content-type': 'application/json', }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Execute a GraphQL mutation. - Future mutation({required Map query}) async { - final String apiPath = '/graphql/mutation'; + Future mutation({required Map query}) async { + final String apiPath = '/graphql/mutation'; final Map apiParams = { - 'query': query, - }; final Map apiHeaders = { 'x-sdk-graphql': 'true', -'content-type': 'application/json', - + 'content-type': 'application/json', }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/health.dart b/lib/services/health.dart index ed3f7662..7e83036f 100644 --- a/lib/services/health.dart +++ b/lib/services/health.dart @@ -1,483 +1,388 @@ part of '../dart_appwrite.dart'; - /// The Health service allows you to both validate and monitor your Appwrite - /// server's health. +/// The Health service allows you to both validate and monitor your Appwrite +/// server's health. class Health extends Service { - Health(super.client); + Health(super.client); /// Check the Appwrite HTTP server is up and responsive. - Future get() async { - final String apiPath = '/health'; + Future get() async { + final String apiPath = '/health'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - - } + } /// Check the Appwrite Antivirus server is up and connection is successful. - Future getAntivirus() async { - final String apiPath = '/health/anti-virus'; + Future getAntivirus() async { + final String apiPath = '/health/anti-virus'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthAntivirus.fromMap(res.data); - - } + } /// Check the Appwrite in-memory cache servers are up and connection is /// successful. - Future getCache() async { - final String apiPath = '/health/cache'; + Future getCache() async { + final String apiPath = '/health/cache'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatusList.fromMap(res.data); - - } + } /// Get the SSL certificate for a domain - Future getCertificate({String? domain}) async { - final String apiPath = '/health/certificate'; + Future getCertificate({String? domain}) async { + final String apiPath = '/health/certificate'; final Map apiParams = { if (domain != null) 'domain': domain, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthCertificate.fromMap(res.data); - - } + } /// Get console pausing health status. Monitors projects approaching the pause /// threshold to detect potential issues with console access tracking. - /// - Future getConsolePausing({int? threshold, int? inactivityDays}) async { - final String apiPath = '/health/console-pausing'; + /// + Future getConsolePausing( + {int? threshold, int? inactivityDays}) async { + final String apiPath = '/health/console-pausing'; final Map apiParams = { if (threshold != null) 'threshold': threshold, -if (inactivityDays != null) 'inactivityDays': inactivityDays, - - + if (inactivityDays != null) 'inactivityDays': inactivityDays, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - - } + } /// Check the Appwrite database servers are up and connection is successful. - Future getDB() async { - final String apiPath = '/health/db'; + Future getDB() async { + final String apiPath = '/health/db'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatusList.fromMap(res.data); - - } + } /// Check the Appwrite pub-sub servers are up and connection is successful. - Future getPubSub() async { - final String apiPath = '/health/pubsub'; + Future getPubSub() async { + final String apiPath = '/health/pubsub'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatusList.fromMap(res.data); - - } + } /// Get the number of audit logs that are waiting to be processed in the /// Appwrite internal queue server. - /// - Future getQueueAudits({int? threshold}) async { - final String apiPath = '/health/queue/audits'; + /// + Future getQueueAudits({int? threshold}) async { + final String apiPath = '/health/queue/audits'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of builds that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueBuilds({int? threshold}) async { - final String apiPath = '/health/queue/builds'; + Future getQueueBuilds({int? threshold}) async { + final String apiPath = '/health/queue/builds'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of certificates that are waiting to be issued against /// [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue /// server. - Future getQueueCertificates({int? threshold}) async { - final String apiPath = '/health/queue/certificates'; + Future getQueueCertificates({int? threshold}) async { + final String apiPath = '/health/queue/certificates'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of database changes that are waiting to be processed in the /// Appwrite internal queue server. - Future getQueueDatabases({String? name, int? threshold}) async { - final String apiPath = '/health/queue/databases'; + Future getQueueDatabases( + {String? name, int? threshold}) async { + final String apiPath = '/health/queue/databases'; final Map apiParams = { if (name != null) 'name': name, -if (threshold != null) 'threshold': threshold, - - + if (threshold != null) 'threshold': threshold, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of background destructive changes that are waiting to be /// processed in the Appwrite internal queue server. - Future getQueueDeletes({int? threshold}) async { - final String apiPath = '/health/queue/deletes'; + Future getQueueDeletes({int? threshold}) async { + final String apiPath = '/health/queue/deletes'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Returns the amount of failed jobs in a given queue. - /// - Future getFailedJobs({required enums.Name name, int? threshold}) async { - final String apiPath = '/health/queue/failed/{name}'.replaceAll('{name}', name.value); + /// + Future getFailedJobs( + {required enums.Name name, int? threshold}) async { + final String apiPath = + '/health/queue/failed/{name}'.replaceAll('{name}', name.value); final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of function executions that are waiting to be processed in /// the Appwrite internal queue server. - Future getQueueFunctions({int? threshold}) async { - final String apiPath = '/health/queue/functions'; + Future getQueueFunctions({int? threshold}) async { + final String apiPath = '/health/queue/functions'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of logs that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueLogs({int? threshold}) async { - final String apiPath = '/health/queue/logs'; + Future getQueueLogs({int? threshold}) async { + final String apiPath = '/health/queue/logs'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of mails that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueMails({int? threshold}) async { - final String apiPath = '/health/queue/mails'; + Future getQueueMails({int? threshold}) async { + final String apiPath = '/health/queue/mails'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of messages that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueMessaging({int? threshold}) async { - final String apiPath = '/health/queue/messaging'; + Future getQueueMessaging({int? threshold}) async { + final String apiPath = '/health/queue/messaging'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of migrations that are waiting to be processed in the /// Appwrite internal queue server. - Future getQueueMigrations({int? threshold}) async { - final String apiPath = '/health/queue/migrations'; + Future getQueueMigrations({int? threshold}) async { + final String apiPath = '/health/queue/migrations'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of metrics that are waiting to be processed in the Appwrite /// stats resources queue. - Future getQueueStatsResources({int? threshold}) async { - final String apiPath = '/health/queue/stats-resources'; + Future getQueueStatsResources({int? threshold}) async { + final String apiPath = '/health/queue/stats-resources'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of metrics that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueUsage({int? threshold}) async { - final String apiPath = '/health/queue/stats-usage'; + Future getQueueUsage({int? threshold}) async { + final String apiPath = '/health/queue/stats-usage'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Get the number of webhooks that are waiting to be processed in the Appwrite /// internal queue server. - Future getQueueWebhooks({int? threshold}) async { - final String apiPath = '/health/queue/webhooks'; + Future getQueueWebhooks({int? threshold}) async { + final String apiPath = '/health/queue/webhooks'; final Map apiParams = { if (threshold != null) 'threshold': threshold, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthQueue.fromMap(res.data); - - } + } /// Check the Appwrite storage device is up and connection is successful. - Future getStorage() async { - final String apiPath = '/health/storage'; + Future getStorage() async { + final String apiPath = '/health/storage'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - - } + } /// Check the Appwrite local storage device is up and connection is successful. - Future getStorageLocal() async { - final String apiPath = '/health/storage/local'; + Future getStorageLocal() async { + final String apiPath = '/health/storage/local'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthStatus.fromMap(res.data); - - } + } /// Check the Appwrite server time is synced with Google remote NTP server. We /// use this technology to smoothly handle leap seconds with no disruptive @@ -486,21 +391,16 @@ if (threshold != null) 'threshold': threshold, /// used by hundreds of millions of computers and devices to synchronize their /// clocks over the Internet. If your computer sets its own clock, it likely /// uses NTP. - Future getTime() async { - final String apiPath = '/health/time'; + Future getTime() async { + final String apiPath = '/health/time'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.HealthTime.fromMap(res.data); - - } + } } diff --git a/lib/services/locale.dart b/lib/services/locale.dart index db59200f..ea005f49 100644 --- a/lib/services/locale.dart +++ b/lib/services/locale.dart @@ -1,172 +1,132 @@ part of '../dart_appwrite.dart'; - /// The Locale service allows you to customize your app based on your users' - /// location. +/// The Locale service allows you to customize your app based on your users' +/// location. class Locale extends Service { - Locale(super.client); + Locale(super.client); /// Get the current user location based on IP. Returns an object with user /// country code, country name, continent name, continent code, ip address and /// suggested currency. You can use the locale header to get the data in a /// supported language. - /// + /// /// ([IP Geolocation by DB-IP](https://db-ip.com)) - Future get() async { - final String apiPath = '/locale'; + Future get() async { + final String apiPath = '/locale'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Locale.fromMap(res.data); - - } + } /// List of all locale codes in [ISO /// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). - Future listCodes() async { - final String apiPath = '/locale/codes'; + Future listCodes() async { + final String apiPath = '/locale/codes'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LocaleCodeList.fromMap(res.data); - - } + } /// List of all continents. You can use the locale header to get the data in a /// supported language. - Future listContinents() async { - final String apiPath = '/locale/continents'; + Future listContinents() async { + final String apiPath = '/locale/continents'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ContinentList.fromMap(res.data); - - } + } /// List of all countries. You can use the locale header to get the data in a /// supported language. - Future listCountries() async { - final String apiPath = '/locale/countries'; + Future listCountries() async { + final String apiPath = '/locale/countries'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.CountryList.fromMap(res.data); - - } + } /// List of all countries that are currently members of the EU. You can use the /// locale header to get the data in a supported language. - Future listCountriesEU() async { - final String apiPath = '/locale/countries/eu'; + Future listCountriesEU() async { + final String apiPath = '/locale/countries/eu'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.CountryList.fromMap(res.data); - - } + } /// List of all countries phone codes. You can use the locale header to get the /// data in a supported language. - Future listCountriesPhones() async { - final String apiPath = '/locale/countries/phones'; + Future listCountriesPhones() async { + final String apiPath = '/locale/countries/phones'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PhoneList.fromMap(res.data); - - } + } /// List of all currencies, including currency symbol, name, plural, and /// decimal digits for all major and minor currencies. You can use the locale /// header to get the data in a supported language. - Future listCurrencies() async { - final String apiPath = '/locale/currencies'; + Future listCurrencies() async { + final String apiPath = '/locale/currencies'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.CurrencyList.fromMap(res.data); - - } + } /// List of all languages classified by ISO 639-1 including 2-letter code, name /// in English, and name in the respective language. - Future listLanguages() async { - final String apiPath = '/locale/languages'; + Future listLanguages() async { + final String apiPath = '/locale/languages'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LanguageList.fromMap(res.data); - - } + } } diff --git a/lib/services/messaging.dart b/lib/services/messaging.dart index 22c766cf..2be72611 100644 --- a/lib/services/messaging.dart +++ b/lib/services/messaging.dart @@ -1,1457 +1,1643 @@ part of '../dart_appwrite.dart'; - /// The Messaging service allows you to send messages to any provider type - /// (SMTP, push notification, SMS, etc.). +/// The Messaging service allows you to send messages to any provider type +/// (SMTP, push notification, SMS, etc.). class Messaging extends Service { - Messaging(super.client); + Messaging(super.client); /// Get a list of all messages from the current Appwrite project. - Future listMessages({List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/messages'; + Future listMessages( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/messages'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MessageList.fromMap(res.data); - - } + } /// Create a new email message. - Future createEmail({required String messageId, required String subject, required String content, List? topics, List? users, List? targets, List? cc, List? bcc, List? attachments, bool? draft, bool? html, String? scheduledAt}) async { - final String apiPath = '/messaging/messages/email'; + Future createEmail( + {required String messageId, + required String subject, + required String content, + List? topics, + List? users, + List? targets, + List? cc, + List? bcc, + List? attachments, + bool? draft, + bool? html, + String? scheduledAt}) async { + final String apiPath = '/messaging/messages/email'; final Map apiParams = { - 'messageId': messageId, -'subject': subject, -'content': content, -if (topics != null) 'topics': topics, -if (users != null) 'users': users, -if (targets != null) 'targets': targets, -if (cc != null) 'cc': cc, -if (bcc != null) 'bcc': bcc, -if (attachments != null) 'attachments': attachments, -if (draft != null) 'draft': draft, -if (html != null) 'html': html, -'scheduledAt': scheduledAt, - + 'subject': subject, + 'content': content, + if (topics != null) 'topics': topics, + if (users != null) 'users': users, + if (targets != null) 'targets': targets, + if (cc != null) 'cc': cc, + if (bcc != null) 'bcc': bcc, + if (attachments != null) 'attachments': attachments, + if (draft != null) 'draft': draft, + if (html != null) 'html': html, + 'scheduledAt': scheduledAt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Update an email message by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - Future updateEmail({required String messageId, List? topics, List? users, List? targets, String? subject, String? content, bool? draft, bool? html, List? cc, List? bcc, String? scheduledAt, List? attachments}) async { - final String apiPath = '/messaging/messages/email/{messageId}'.replaceAll('{messageId}', messageId); + /// + Future updateEmail( + {required String messageId, + List? topics, + List? users, + List? targets, + String? subject, + String? content, + bool? draft, + bool? html, + List? cc, + List? bcc, + String? scheduledAt, + List? attachments}) async { + final String apiPath = '/messaging/messages/email/{messageId}' + .replaceAll('{messageId}', messageId); final Map apiParams = { - 'topics': topics, -'users': users, -'targets': targets, -'subject': subject, -'content': content, -'draft': draft, -'html': html, -'cc': cc, -'bcc': bcc, -'scheduledAt': scheduledAt, -'attachments': attachments, - + 'users': users, + 'targets': targets, + 'subject': subject, + 'content': content, + 'draft': draft, + 'html': html, + 'cc': cc, + 'bcc': bcc, + 'scheduledAt': scheduledAt, + 'attachments': attachments, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Create a new push notification. - Future createPush({required String messageId, String? title, String? body, List? topics, List? users, List? targets, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, int? badge, bool? draft, String? scheduledAt, bool? contentAvailable, bool? critical, enums.MessagePriority? priority}) async { - final String apiPath = '/messaging/messages/push'; + Future createPush( + {required String messageId, + String? title, + String? body, + List? topics, + List? users, + List? targets, + Map? data, + String? action, + String? image, + String? icon, + String? sound, + String? color, + String? tag, + int? badge, + bool? draft, + String? scheduledAt, + bool? contentAvailable, + bool? critical, + enums.MessagePriority? priority}) async { + final String apiPath = '/messaging/messages/push'; final Map apiParams = { - 'messageId': messageId, -if (title != null) 'title': title, -if (body != null) 'body': body, -if (topics != null) 'topics': topics, -if (users != null) 'users': users, -if (targets != null) 'targets': targets, -'data': data, -if (action != null) 'action': action, -if (image != null) 'image': image, -if (icon != null) 'icon': icon, -if (sound != null) 'sound': sound, -if (color != null) 'color': color, -if (tag != null) 'tag': tag, -if (badge != null) 'badge': badge, -if (draft != null) 'draft': draft, -'scheduledAt': scheduledAt, -if (contentAvailable != null) 'contentAvailable': contentAvailable, -if (critical != null) 'critical': critical, -if (priority != null) 'priority': priority.value, - + if (title != null) 'title': title, + if (body != null) 'body': body, + if (topics != null) 'topics': topics, + if (users != null) 'users': users, + if (targets != null) 'targets': targets, + 'data': data, + if (action != null) 'action': action, + if (image != null) 'image': image, + if (icon != null) 'icon': icon, + if (sound != null) 'sound': sound, + if (color != null) 'color': color, + if (tag != null) 'tag': tag, + if (badge != null) 'badge': badge, + if (draft != null) 'draft': draft, + 'scheduledAt': scheduledAt, + if (contentAvailable != null) 'contentAvailable': contentAvailable, + if (critical != null) 'critical': critical, + if (priority != null) 'priority': priority.value, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Update a push notification by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - Future updatePush({required String messageId, List? topics, List? users, List? targets, String? title, String? body, Map? data, String? action, String? image, String? icon, String? sound, String? color, String? tag, int? badge, bool? draft, String? scheduledAt, bool? contentAvailable, bool? critical, enums.MessagePriority? priority}) async { - final String apiPath = '/messaging/messages/push/{messageId}'.replaceAll('{messageId}', messageId); + /// + Future updatePush( + {required String messageId, + List? topics, + List? users, + List? targets, + String? title, + String? body, + Map? data, + String? action, + String? image, + String? icon, + String? sound, + String? color, + String? tag, + int? badge, + bool? draft, + String? scheduledAt, + bool? contentAvailable, + bool? critical, + enums.MessagePriority? priority}) async { + final String apiPath = '/messaging/messages/push/{messageId}' + .replaceAll('{messageId}', messageId); final Map apiParams = { - 'topics': topics, -'users': users, -'targets': targets, -'title': title, -'body': body, -'data': data, -'action': action, -'image': image, -'icon': icon, -'sound': sound, -'color': color, -'tag': tag, -'badge': badge, -'draft': draft, -'scheduledAt': scheduledAt, -'contentAvailable': contentAvailable, -'critical': critical, -'priority': priority?.value, - + 'users': users, + 'targets': targets, + 'title': title, + 'body': body, + 'data': data, + 'action': action, + 'image': image, + 'icon': icon, + 'sound': sound, + 'color': color, + 'tag': tag, + 'badge': badge, + 'draft': draft, + 'scheduledAt': scheduledAt, + 'contentAvailable': contentAvailable, + 'critical': critical, + 'priority': priority?.value, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Create a new SMS message. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead.') - Future createSms({required String messageId, required String content, List? topics, List? users, List? targets, bool? draft, String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead.') + Future createSms( + {required String messageId, + required String content, + List? topics, + List? users, + List? targets, + bool? draft, + String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms'; final Map apiParams = { - 'messageId': messageId, -'content': content, -if (topics != null) 'topics': topics, -if (users != null) 'users': users, -if (targets != null) 'targets': targets, -if (draft != null) 'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + if (topics != null) 'topics': topics, + if (users != null) 'users': users, + if (targets != null) 'targets': targets, + if (draft != null) 'draft': draft, + 'scheduledAt': scheduledAt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Create a new SMS message. - Future createSMS({required String messageId, required String content, List? topics, List? users, List? targets, bool? draft, String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms'; + Future createSMS( + {required String messageId, + required String content, + List? topics, + List? users, + List? targets, + bool? draft, + String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms'; final Map apiParams = { - 'messageId': messageId, -'content': content, -if (topics != null) 'topics': topics, -if (users != null) 'users': users, -if (targets != null) 'targets': targets, -if (draft != null) 'draft': draft, -'scheduledAt': scheduledAt, - + 'content': content, + if (topics != null) 'topics': topics, + if (users != null) 'users': users, + if (targets != null) 'targets': targets, + if (draft != null) 'draft': draft, + 'scheduledAt': scheduledAt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Update an SMS message by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead.') - Future updateSms({required String messageId, List? topics, List? users, List? targets, String? content, bool? draft, String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead.') + Future updateSms( + {required String messageId, + List? topics, + List? users, + List? targets, + String? content, + bool? draft, + String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms/{messageId}' + .replaceAll('{messageId}', messageId); final Map apiParams = { - 'topics': topics, -'users': users, -'targets': targets, -'content': content, -'draft': draft, -'scheduledAt': scheduledAt, - + 'users': users, + 'targets': targets, + 'content': content, + 'draft': draft, + 'scheduledAt': scheduledAt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Update an SMS message by its unique ID. This endpoint only works on /// messages that are in draft status. Messages that are already processing, /// sent, or failed cannot be updated. - /// - Future updateSMS({required String messageId, List? topics, List? users, List? targets, String? content, bool? draft, String? scheduledAt}) async { - final String apiPath = '/messaging/messages/sms/{messageId}'.replaceAll('{messageId}', messageId); + /// + Future updateSMS( + {required String messageId, + List? topics, + List? users, + List? targets, + String? content, + bool? draft, + String? scheduledAt}) async { + final String apiPath = '/messaging/messages/sms/{messageId}' + .replaceAll('{messageId}', messageId); final Map apiParams = { - 'topics': topics, -'users': users, -'targets': targets, -'content': content, -'draft': draft, -'scheduledAt': scheduledAt, - + 'users': users, + 'targets': targets, + 'content': content, + 'draft': draft, + 'scheduledAt': scheduledAt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Get a message by its unique ID. - /// - Future getMessage({required String messageId}) async { - final String apiPath = '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); + /// + Future getMessage({required String messageId}) async { + final String apiPath = + '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Message.fromMap(res.data); - - } + } /// Delete a message. If the message is not a draft or scheduled, but has been /// sent, this will not recall the message. - Future delete({required String messageId}) async { - final String apiPath = '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); + Future delete({required String messageId}) async { + final String apiPath = + '/messaging/messages/{messageId}'.replaceAll('{messageId}', messageId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get the message activity logs listed by its unique ID. - Future listMessageLogs({required String messageId, List? queries, bool? total}) async { - final String apiPath = '/messaging/messages/{messageId}/logs'.replaceAll('{messageId}', messageId); + Future listMessageLogs( + {required String messageId, List? queries, bool? total}) async { + final String apiPath = '/messaging/messages/{messageId}/logs' + .replaceAll('{messageId}', messageId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - - } + } /// Get a list of the targets associated with a message. - Future listTargets({required String messageId, List? queries, bool? total}) async { - final String apiPath = '/messaging/messages/{messageId}/targets'.replaceAll('{messageId}', messageId); + Future listTargets( + {required String messageId, List? queries, bool? total}) async { + final String apiPath = '/messaging/messages/{messageId}/targets' + .replaceAll('{messageId}', messageId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TargetList.fromMap(res.data); - - } + } /// Get a list of all providers from the current Appwrite project. - Future listProviders({List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/providers'; + Future listProviders( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/providers'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProviderList.fromMap(res.data); - - } + } /// Create a new Apple Push Notification service provider. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead.') - Future createApnsProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox, bool? enabled}) async { - final String apiPath = '/messaging/providers/apns'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead.') + Future createApnsProvider( + {required String providerId, + required String name, + String? authKey, + String? authKeyId, + String? teamId, + String? bundleId, + bool? sandbox, + bool? enabled}) async { + final String apiPath = '/messaging/providers/apns'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (authKey != null) 'authKey': authKey, -if (authKeyId != null) 'authKeyId': authKeyId, -if (teamId != null) 'teamId': teamId, -if (bundleId != null) 'bundleId': bundleId, -if (sandbox != null) 'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + if (authKey != null) 'authKey': authKey, + if (authKeyId != null) 'authKeyId': authKeyId, + if (teamId != null) 'teamId': teamId, + if (bundleId != null) 'bundleId': bundleId, + if (sandbox != null) 'sandbox': sandbox, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Apple Push Notification service provider. - Future createAPNSProvider({required String providerId, required String name, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox, bool? enabled}) async { - final String apiPath = '/messaging/providers/apns'; + Future createAPNSProvider( + {required String providerId, + required String name, + String? authKey, + String? authKeyId, + String? teamId, + String? bundleId, + bool? sandbox, + bool? enabled}) async { + final String apiPath = '/messaging/providers/apns'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (authKey != null) 'authKey': authKey, -if (authKeyId != null) 'authKeyId': authKeyId, -if (teamId != null) 'teamId': teamId, -if (bundleId != null) 'bundleId': bundleId, -if (sandbox != null) 'sandbox': sandbox, -'enabled': enabled, - + 'name': name, + if (authKey != null) 'authKey': authKey, + if (authKeyId != null) 'authKeyId': authKeyId, + if (teamId != null) 'teamId': teamId, + if (bundleId != null) 'bundleId': bundleId, + if (sandbox != null) 'sandbox': sandbox, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Apple Push Notification service provider by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead.') - Future updateApnsProvider({required String providerId, String? name, bool? enabled, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox}) async { - final String apiPath = '/messaging/providers/apns/{providerId}'.replaceAll('{providerId}', providerId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead.') + Future updateApnsProvider( + {required String providerId, + String? name, + bool? enabled, + String? authKey, + String? authKeyId, + String? teamId, + String? bundleId, + bool? sandbox}) async { + final String apiPath = '/messaging/providers/apns/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (authKey != null) 'authKey': authKey, -if (authKeyId != null) 'authKeyId': authKeyId, -if (teamId != null) 'teamId': teamId, -if (bundleId != null) 'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + if (authKey != null) 'authKey': authKey, + if (authKeyId != null) 'authKeyId': authKeyId, + if (teamId != null) 'teamId': teamId, + if (bundleId != null) 'bundleId': bundleId, + 'sandbox': sandbox, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Apple Push Notification service provider by its unique ID. - Future updateAPNSProvider({required String providerId, String? name, bool? enabled, String? authKey, String? authKeyId, String? teamId, String? bundleId, bool? sandbox}) async { - final String apiPath = '/messaging/providers/apns/{providerId}'.replaceAll('{providerId}', providerId); + Future updateAPNSProvider( + {required String providerId, + String? name, + bool? enabled, + String? authKey, + String? authKeyId, + String? teamId, + String? bundleId, + bool? sandbox}) async { + final String apiPath = '/messaging/providers/apns/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (authKey != null) 'authKey': authKey, -if (authKeyId != null) 'authKeyId': authKeyId, -if (teamId != null) 'teamId': teamId, -if (bundleId != null) 'bundleId': bundleId, -'sandbox': sandbox, - + 'enabled': enabled, + if (authKey != null) 'authKey': authKey, + if (authKeyId != null) 'authKeyId': authKeyId, + if (teamId != null) 'teamId': teamId, + if (bundleId != null) 'bundleId': bundleId, + 'sandbox': sandbox, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Firebase Cloud Messaging provider. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead.') - Future createFcmProvider({required String providerId, required String name, Map? serviceAccountJSON, bool? enabled}) async { - final String apiPath = '/messaging/providers/fcm'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead.') + Future createFcmProvider( + {required String providerId, + required String name, + Map? serviceAccountJSON, + bool? enabled}) async { + final String apiPath = '/messaging/providers/fcm'; final Map apiParams = { - 'providerId': providerId, -'name': name, -'serviceAccountJSON': serviceAccountJSON, -'enabled': enabled, - + 'name': name, + 'serviceAccountJSON': serviceAccountJSON, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Firebase Cloud Messaging provider. - Future createFCMProvider({required String providerId, required String name, Map? serviceAccountJSON, bool? enabled}) async { - final String apiPath = '/messaging/providers/fcm'; + Future createFCMProvider( + {required String providerId, + required String name, + Map? serviceAccountJSON, + bool? enabled}) async { + final String apiPath = '/messaging/providers/fcm'; final Map apiParams = { - 'providerId': providerId, -'name': name, -'serviceAccountJSON': serviceAccountJSON, -'enabled': enabled, - + 'name': name, + 'serviceAccountJSON': serviceAccountJSON, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Firebase Cloud Messaging provider by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead.') - Future updateFcmProvider({required String providerId, String? name, bool? enabled, Map? serviceAccountJSON}) async { - final String apiPath = '/messaging/providers/fcm/{providerId}'.replaceAll('{providerId}', providerId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead.') + Future updateFcmProvider( + {required String providerId, + String? name, + bool? enabled, + Map? serviceAccountJSON}) async { + final String apiPath = '/messaging/providers/fcm/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Firebase Cloud Messaging provider by its unique ID. - Future updateFCMProvider({required String providerId, String? name, bool? enabled, Map? serviceAccountJSON}) async { - final String apiPath = '/messaging/providers/fcm/{providerId}'.replaceAll('{providerId}', providerId); + Future updateFCMProvider( + {required String providerId, + String? name, + bool? enabled, + Map? serviceAccountJSON}) async { + final String apiPath = '/messaging/providers/fcm/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -'serviceAccountJSON': serviceAccountJSON, - + 'enabled': enabled, + 'serviceAccountJSON': serviceAccountJSON, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Mailgun provider. - Future createMailgunProvider({required String providerId, required String name, String? apiKey, String? domain, bool? isEuRegion, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/mailgun'; + Future createMailgunProvider( + {required String providerId, + required String name, + String? apiKey, + String? domain, + bool? isEuRegion, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/mailgun'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (apiKey != null) 'apiKey': apiKey, -if (domain != null) 'domain': domain, -'isEuRegion': isEuRegion, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + if (apiKey != null) 'apiKey': apiKey, + if (domain != null) 'domain': domain, + 'isEuRegion': isEuRegion, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Mailgun provider by its unique ID. - Future updateMailgunProvider({required String providerId, String? name, String? apiKey, String? domain, bool? isEuRegion, bool? enabled, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail}) async { - final String apiPath = '/messaging/providers/mailgun/{providerId}'.replaceAll('{providerId}', providerId); + Future updateMailgunProvider( + {required String providerId, + String? name, + String? apiKey, + String? domain, + bool? isEuRegion, + bool? enabled, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail}) async { + final String apiPath = '/messaging/providers/mailgun/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -if (apiKey != null) 'apiKey': apiKey, -if (domain != null) 'domain': domain, -'isEuRegion': isEuRegion, -'enabled': enabled, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, - + if (apiKey != null) 'apiKey': apiKey, + if (domain != null) 'domain': domain, + 'isEuRegion': isEuRegion, + 'enabled': enabled, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new MSG91 provider. - Future createMsg91Provider({required String providerId, required String name, String? templateId, String? senderId, String? authKey, bool? enabled}) async { - final String apiPath = '/messaging/providers/msg91'; + Future createMsg91Provider( + {required String providerId, + required String name, + String? templateId, + String? senderId, + String? authKey, + bool? enabled}) async { + final String apiPath = '/messaging/providers/msg91'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (templateId != null) 'templateId': templateId, -if (senderId != null) 'senderId': senderId, -if (authKey != null) 'authKey': authKey, -'enabled': enabled, - + 'name': name, + if (templateId != null) 'templateId': templateId, + if (senderId != null) 'senderId': senderId, + if (authKey != null) 'authKey': authKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a MSG91 provider by its unique ID. - Future updateMsg91Provider({required String providerId, String? name, bool? enabled, String? templateId, String? senderId, String? authKey}) async { - final String apiPath = '/messaging/providers/msg91/{providerId}'.replaceAll('{providerId}', providerId); + Future updateMsg91Provider( + {required String providerId, + String? name, + bool? enabled, + String? templateId, + String? senderId, + String? authKey}) async { + final String apiPath = '/messaging/providers/msg91/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (templateId != null) 'templateId': templateId, -if (senderId != null) 'senderId': senderId, -if (authKey != null) 'authKey': authKey, - + 'enabled': enabled, + if (templateId != null) 'templateId': templateId, + if (senderId != null) 'senderId': senderId, + if (authKey != null) 'authKey': authKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Resend provider. - Future createResendProvider({required String providerId, required String name, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/resend'; + Future createResendProvider( + {required String providerId, + required String name, + String? apiKey, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/resend'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (apiKey != null) 'apiKey': apiKey, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + if (apiKey != null) 'apiKey': apiKey, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Resend provider by its unique ID. - Future updateResendProvider({required String providerId, String? name, bool? enabled, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail}) async { - final String apiPath = '/messaging/providers/resend/{providerId}'.replaceAll('{providerId}', providerId); + Future updateResendProvider( + {required String providerId, + String? name, + bool? enabled, + String? apiKey, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail}) async { + final String apiPath = '/messaging/providers/resend/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (apiKey != null) 'apiKey': apiKey, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, - + 'enabled': enabled, + if (apiKey != null) 'apiKey': apiKey, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Sendgrid provider. - Future createSendgridProvider({required String providerId, required String name, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/sendgrid'; + Future createSendgridProvider( + {required String providerId, + required String name, + String? apiKey, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/sendgrid'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (apiKey != null) 'apiKey': apiKey, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + if (apiKey != null) 'apiKey': apiKey, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Sendgrid provider by its unique ID. - Future updateSendgridProvider({required String providerId, String? name, bool? enabled, String? apiKey, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail}) async { - final String apiPath = '/messaging/providers/sendgrid/{providerId}'.replaceAll('{providerId}', providerId); + Future updateSendgridProvider( + {required String providerId, + String? name, + bool? enabled, + String? apiKey, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail}) async { + final String apiPath = '/messaging/providers/sendgrid/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (apiKey != null) 'apiKey': apiKey, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, - + 'enabled': enabled, + if (apiKey != null) 'apiKey': apiKey, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new SMTP provider. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead.') - Future createSmtpProvider({required String providerId, required String name, required String host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp'; + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead.') + Future createSmtpProvider( + {required String providerId, + required String name, + required String host, + int? port, + String? username, + String? password, + enums.SmtpEncryption? encryption, + bool? autoTLS, + String? mailer, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp'; final Map apiParams = { - 'providerId': providerId, -'name': name, -'host': host, -if (port != null) 'port': port, -if (username != null) 'username': username, -if (password != null) 'password': password, -if (encryption != null) 'encryption': encryption.value, -if (autoTLS != null) 'autoTLS': autoTLS, -if (mailer != null) 'mailer': mailer, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'host': host, + if (port != null) 'port': port, + if (username != null) 'username': username, + if (password != null) 'password': password, + if (encryption != null) 'encryption': encryption.value, + if (autoTLS != null) 'autoTLS': autoTLS, + if (mailer != null) 'mailer': mailer, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new SMTP provider. - Future createSMTPProvider({required String providerId, required String name, required String host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp'; + Future createSMTPProvider( + {required String providerId, + required String name, + required String host, + int? port, + String? username, + String? password, + enums.SmtpEncryption? encryption, + bool? autoTLS, + String? mailer, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp'; final Map apiParams = { - 'providerId': providerId, -'name': name, -'host': host, -if (port != null) 'port': port, -if (username != null) 'username': username, -if (password != null) 'password': password, -if (encryption != null) 'encryption': encryption.value, -if (autoTLS != null) 'autoTLS': autoTLS, -if (mailer != null) 'mailer': mailer, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + 'name': name, + 'host': host, + if (port != null) 'port': port, + if (username != null) 'username': username, + if (password != null) 'password': password, + if (encryption != null) 'encryption': encryption.value, + if (autoTLS != null) 'autoTLS': autoTLS, + if (mailer != null) 'mailer': mailer, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a SMTP provider by its unique ID. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead.') - Future updateSmtpProvider({required String providerId, String? name, String? host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp/{providerId}'.replaceAll('{providerId}', providerId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead.') + Future updateSmtpProvider( + {required String providerId, + String? name, + String? host, + int? port, + String? username, + String? password, + enums.SmtpEncryption? encryption, + bool? autoTLS, + String? mailer, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -if (host != null) 'host': host, -'port': port, -if (username != null) 'username': username, -if (password != null) 'password': password, -if (encryption != null) 'encryption': encryption.value, -'autoTLS': autoTLS, -if (mailer != null) 'mailer': mailer, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + if (host != null) 'host': host, + 'port': port, + if (username != null) 'username': username, + if (password != null) 'password': password, + if (encryption != null) 'encryption': encryption.value, + 'autoTLS': autoTLS, + if (mailer != null) 'mailer': mailer, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a SMTP provider by its unique ID. - Future updateSMTPProvider({required String providerId, String? name, String? host, int? port, String? username, String? password, enums.SmtpEncryption? encryption, bool? autoTLS, String? mailer, String? fromName, String? fromEmail, String? replyToName, String? replyToEmail, bool? enabled}) async { - final String apiPath = '/messaging/providers/smtp/{providerId}'.replaceAll('{providerId}', providerId); + Future updateSMTPProvider( + {required String providerId, + String? name, + String? host, + int? port, + String? username, + String? password, + enums.SmtpEncryption? encryption, + bool? autoTLS, + String? mailer, + String? fromName, + String? fromEmail, + String? replyToName, + String? replyToEmail, + bool? enabled}) async { + final String apiPath = '/messaging/providers/smtp/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -if (host != null) 'host': host, -'port': port, -if (username != null) 'username': username, -if (password != null) 'password': password, -if (encryption != null) 'encryption': encryption.value, -'autoTLS': autoTLS, -if (mailer != null) 'mailer': mailer, -if (fromName != null) 'fromName': fromName, -if (fromEmail != null) 'fromEmail': fromEmail, -if (replyToName != null) 'replyToName': replyToName, -if (replyToEmail != null) 'replyToEmail': replyToEmail, -'enabled': enabled, - + if (host != null) 'host': host, + 'port': port, + if (username != null) 'username': username, + if (password != null) 'password': password, + if (encryption != null) 'encryption': encryption.value, + 'autoTLS': autoTLS, + if (mailer != null) 'mailer': mailer, + if (fromName != null) 'fromName': fromName, + if (fromEmail != null) 'fromEmail': fromEmail, + if (replyToName != null) 'replyToName': replyToName, + if (replyToEmail != null) 'replyToEmail': replyToEmail, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Telesign provider. - Future createTelesignProvider({required String providerId, required String name, String? from, String? customerId, String? apiKey, bool? enabled}) async { - final String apiPath = '/messaging/providers/telesign'; + Future createTelesignProvider( + {required String providerId, + required String name, + String? from, + String? customerId, + String? apiKey, + bool? enabled}) async { + final String apiPath = '/messaging/providers/telesign'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (from != null) 'from': from, -if (customerId != null) 'customerId': customerId, -if (apiKey != null) 'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + if (from != null) 'from': from, + if (customerId != null) 'customerId': customerId, + if (apiKey != null) 'apiKey': apiKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Telesign provider by its unique ID. - Future updateTelesignProvider({required String providerId, String? name, bool? enabled, String? customerId, String? apiKey, String? from}) async { - final String apiPath = '/messaging/providers/telesign/{providerId}'.replaceAll('{providerId}', providerId); + Future updateTelesignProvider( + {required String providerId, + String? name, + bool? enabled, + String? customerId, + String? apiKey, + String? from}) async { + final String apiPath = '/messaging/providers/telesign/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (customerId != null) 'customerId': customerId, -if (apiKey != null) 'apiKey': apiKey, -if (from != null) 'from': from, - + 'enabled': enabled, + if (customerId != null) 'customerId': customerId, + if (apiKey != null) 'apiKey': apiKey, + if (from != null) 'from': from, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Textmagic provider. - Future createTextmagicProvider({required String providerId, required String name, String? from, String? username, String? apiKey, bool? enabled}) async { - final String apiPath = '/messaging/providers/textmagic'; + Future createTextmagicProvider( + {required String providerId, + required String name, + String? from, + String? username, + String? apiKey, + bool? enabled}) async { + final String apiPath = '/messaging/providers/textmagic'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (from != null) 'from': from, -if (username != null) 'username': username, -if (apiKey != null) 'apiKey': apiKey, -'enabled': enabled, - + 'name': name, + if (from != null) 'from': from, + if (username != null) 'username': username, + if (apiKey != null) 'apiKey': apiKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Textmagic provider by its unique ID. - Future updateTextmagicProvider({required String providerId, String? name, bool? enabled, String? username, String? apiKey, String? from}) async { - final String apiPath = '/messaging/providers/textmagic/{providerId}'.replaceAll('{providerId}', providerId); + Future updateTextmagicProvider( + {required String providerId, + String? name, + bool? enabled, + String? username, + String? apiKey, + String? from}) async { + final String apiPath = '/messaging/providers/textmagic/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (username != null) 'username': username, -if (apiKey != null) 'apiKey': apiKey, -if (from != null) 'from': from, - + 'enabled': enabled, + if (username != null) 'username': username, + if (apiKey != null) 'apiKey': apiKey, + if (from != null) 'from': from, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Twilio provider. - Future createTwilioProvider({required String providerId, required String name, String? from, String? accountSid, String? authToken, bool? enabled}) async { - final String apiPath = '/messaging/providers/twilio'; + Future createTwilioProvider( + {required String providerId, + required String name, + String? from, + String? accountSid, + String? authToken, + bool? enabled}) async { + final String apiPath = '/messaging/providers/twilio'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (from != null) 'from': from, -if (accountSid != null) 'accountSid': accountSid, -if (authToken != null) 'authToken': authToken, -'enabled': enabled, - + 'name': name, + if (from != null) 'from': from, + if (accountSid != null) 'accountSid': accountSid, + if (authToken != null) 'authToken': authToken, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Twilio provider by its unique ID. - Future updateTwilioProvider({required String providerId, String? name, bool? enabled, String? accountSid, String? authToken, String? from}) async { - final String apiPath = '/messaging/providers/twilio/{providerId}'.replaceAll('{providerId}', providerId); + Future updateTwilioProvider( + {required String providerId, + String? name, + bool? enabled, + String? accountSid, + String? authToken, + String? from}) async { + final String apiPath = '/messaging/providers/twilio/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (accountSid != null) 'accountSid': accountSid, -if (authToken != null) 'authToken': authToken, -if (from != null) 'from': from, - + 'enabled': enabled, + if (accountSid != null) 'accountSid': accountSid, + if (authToken != null) 'authToken': authToken, + if (from != null) 'from': from, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Create a new Vonage provider. - Future createVonageProvider({required String providerId, required String name, String? from, String? apiKey, String? apiSecret, bool? enabled}) async { - final String apiPath = '/messaging/providers/vonage'; + Future createVonageProvider( + {required String providerId, + required String name, + String? from, + String? apiKey, + String? apiSecret, + bool? enabled}) async { + final String apiPath = '/messaging/providers/vonage'; final Map apiParams = { - 'providerId': providerId, -'name': name, -if (from != null) 'from': from, -if (apiKey != null) 'apiKey': apiKey, -if (apiSecret != null) 'apiSecret': apiSecret, -'enabled': enabled, - + 'name': name, + if (from != null) 'from': from, + if (apiKey != null) 'apiKey': apiKey, + if (apiSecret != null) 'apiSecret': apiSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Update a Vonage provider by its unique ID. - Future updateVonageProvider({required String providerId, String? name, bool? enabled, String? apiKey, String? apiSecret, String? from}) async { - final String apiPath = '/messaging/providers/vonage/{providerId}'.replaceAll('{providerId}', providerId); + Future updateVonageProvider( + {required String providerId, + String? name, + bool? enabled, + String? apiKey, + String? apiSecret, + String? from}) async { + final String apiPath = '/messaging/providers/vonage/{providerId}' + .replaceAll('{providerId}', providerId); final Map apiParams = { - if (name != null) 'name': name, -'enabled': enabled, -if (apiKey != null) 'apiKey': apiKey, -if (apiSecret != null) 'apiSecret': apiSecret, -if (from != null) 'from': from, - + 'enabled': enabled, + if (apiKey != null) 'apiKey': apiKey, + if (apiSecret != null) 'apiSecret': apiSecret, + if (from != null) 'from': from, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Get a provider by its unique ID. - /// - Future getProvider({required String providerId}) async { - final String apiPath = '/messaging/providers/{providerId}'.replaceAll('{providerId}', providerId); + /// + Future getProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}' + .replaceAll('{providerId}', providerId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Provider.fromMap(res.data); - - } + } /// Delete a provider by its unique ID. - Future deleteProvider({required String providerId}) async { - final String apiPath = '/messaging/providers/{providerId}'.replaceAll('{providerId}', providerId); + Future deleteProvider({required String providerId}) async { + final String apiPath = '/messaging/providers/{providerId}' + .replaceAll('{providerId}', providerId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get the provider activity logs listed by its unique ID. - Future listProviderLogs({required String providerId, List? queries, bool? total}) async { - final String apiPath = '/messaging/providers/{providerId}/logs'.replaceAll('{providerId}', providerId); + Future listProviderLogs( + {required String providerId, List? queries, bool? total}) async { + final String apiPath = '/messaging/providers/{providerId}/logs' + .replaceAll('{providerId}', providerId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - - } + } /// Get the subscriber activity logs listed by its unique ID. - Future listSubscriberLogs({required String subscriberId, List? queries, bool? total}) async { - final String apiPath = '/messaging/subscribers/{subscriberId}/logs'.replaceAll('{subscriberId}', subscriberId); + Future listSubscriberLogs( + {required String subscriberId, + List? queries, + bool? total}) async { + final String apiPath = '/messaging/subscribers/{subscriberId}/logs' + .replaceAll('{subscriberId}', subscriberId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - - } + } /// Get a list of all topics from the current Appwrite project. - Future listTopics({List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/topics'; + Future listTopics( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TopicList.fromMap(res.data); - - } + } /// Create a new topic. - Future createTopic({required String topicId, required String name, List? subscribe}) async { - final String apiPath = '/messaging/topics'; + Future createTopic( + {required String topicId, + required String name, + List? subscribe}) async { + final String apiPath = '/messaging/topics'; final Map apiParams = { - 'topicId': topicId, -'name': name, -if (subscribe != null) 'subscribe': subscribe, - + 'name': name, + if (subscribe != null) 'subscribe': subscribe, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Topic.fromMap(res.data); - - } + } /// Get a topic by its unique ID. - /// - Future getTopic({required String topicId}) async { - final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + /// + Future getTopic({required String topicId}) async { + final String apiPath = + '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Topic.fromMap(res.data); - - } + } /// Update a topic by its unique ID. - /// - Future updateTopic({required String topicId, String? name, List? subscribe}) async { - final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + /// + Future updateTopic( + {required String topicId, String? name, List? subscribe}) async { + final String apiPath = + '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); final Map apiParams = { - 'name': name, -'subscribe': subscribe, - + 'subscribe': subscribe, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Topic.fromMap(res.data); - - } + } /// Delete a topic by its unique ID. - Future deleteTopic({required String topicId}) async { - final String apiPath = '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); + Future deleteTopic({required String topicId}) async { + final String apiPath = + '/messaging/topics/{topicId}'.replaceAll('{topicId}', topicId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get the topic activity logs listed by its unique ID. - Future listTopicLogs({required String topicId, List? queries, bool? total}) async { - final String apiPath = '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); + Future listTopicLogs( + {required String topicId, List? queries, bool? total}) async { + final String apiPath = + '/messaging/topics/{topicId}/logs'.replaceAll('{topicId}', topicId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - - } + } /// Get a list of all subscribers from the current Appwrite project. - Future listSubscribers({required String topicId, List? queries, String? search, bool? total}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future listSubscribers( + {required String topicId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers' + .replaceAll('{topicId}', topicId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.SubscriberList.fromMap(res.data); - - } + } /// Create a new subscriber. - Future createSubscriber({required String topicId, required String subscriberId, required String targetId}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers'.replaceAll('{topicId}', topicId); + Future createSubscriber( + {required String topicId, + required String subscriberId, + required String targetId}) async { + final String apiPath = '/messaging/topics/{topicId}/subscribers' + .replaceAll('{topicId}', topicId); final Map apiParams = { - 'subscriberId': subscriberId, -'targetId': targetId, - + 'targetId': targetId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Subscriber.fromMap(res.data); - - } + } /// Get a subscriber by its unique ID. - /// - Future getSubscriber({required String topicId, required String subscriberId}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replaceAll('{topicId}', topicId).replaceAll('{subscriberId}', subscriberId); + /// + Future getSubscriber( + {required String topicId, required String subscriberId}) async { + final String apiPath = + '/messaging/topics/{topicId}/subscribers/{subscriberId}' + .replaceAll('{topicId}', topicId) + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Subscriber.fromMap(res.data); - - } + } /// Delete a subscriber by its unique ID. - Future deleteSubscriber({required String topicId, required String subscriberId}) async { - final String apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replaceAll('{topicId}', topicId).replaceAll('{subscriberId}', subscriberId); + Future deleteSubscriber( + {required String topicId, required String subscriberId}) async { + final String apiPath = + '/messaging/topics/{topicId}/subscribers/{subscriberId}' + .replaceAll('{topicId}', topicId) + .replaceAll('{subscriberId}', subscriberId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/presences.dart b/lib/services/presences.dart index 1b7fc69d..6be6db86 100644 --- a/lib/services/presences.dart +++ b/lib/services/presences.dart @@ -1,117 +1,116 @@ part of '../dart_appwrite.dart'; class Presences extends Service { - Presences(super.client); + Presences(super.client); /// List presence logs. - Future list({List? queries, bool? total, int? ttl}) async { - final String apiPath = '/presences'; + Future list( + {List? queries, bool? total, int? ttl}) async { + final String apiPath = '/presences'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, -if (ttl != null) 'ttl': ttl, - - + if (total != null) 'total': total, + if (ttl != null) 'ttl': ttl, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PresenceList.fromMap(res.data); - - } + } /// Get a presence log by its unique ID. - Future get({required String presenceId}) async { - final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + Future get({required String presenceId}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Presence.fromMap(res.data); - - } + } /// Create or update a presence log by its unique ID. - Future upsert({required String presenceId, required String? userId, required String status, List? permissions, String? expiresAt, Map? metadata}) async { - final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + Future upsert( + {required String presenceId, + required String? userId, + required String status, + List? permissions, + String? expiresAt, + Map? metadata}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); final Map apiParams = { - 'userId': userId, -'status': status, -'permissions': permissions, -'expiresAt': expiresAt, -if (metadata != null) 'metadata': metadata, - + 'status': status, + 'permissions': permissions, + 'expiresAt': expiresAt, + if (metadata != null) 'metadata': metadata, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Presence.fromMap(res.data); - - } + } /// Update a presence log by its unique ID. - Future updatePresence({required String presenceId, required String? userId, String? status, String? expiresAt, Map? metadata, List? permissions, bool? purge}) async { - final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + Future updatePresence( + {required String presenceId, + required String? userId, + String? status, + String? expiresAt, + Map? metadata, + List? permissions, + bool? purge}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); final Map apiParams = { - 'userId': userId, -'status': status, -'expiresAt': expiresAt, -'metadata': metadata, -'permissions': permissions, -if (purge != null) 'purge': purge, - + 'status': status, + 'expiresAt': expiresAt, + 'metadata': metadata, + 'permissions': permissions, + if (purge != null) 'purge': purge, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Presence.fromMap(res.data); - - } + } /// Delete a presence log by its unique ID. - Future delete({required String presenceId}) async { - final String apiPath = '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); + Future delete({required String presenceId}) async { + final String apiPath = + '/presences/{presenceId}'.replaceAll('{presenceId}', presenceId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/project.dart b/lib/services/project.dart index 0baef815..92c1bb08 100644 --- a/lib/services/project.dart +++ b/lib/services/project.dart @@ -1,364 +1,326 @@ part of '../dart_appwrite.dart'; - /// The Project service allows you to manage all the projects in your Appwrite - /// server. +/// The Project service allows you to manage all the projects in your Appwrite +/// server. class Project extends Service { - Project(super.client); + Project(super.client); /// Delete a project. - Future delete() async { - final String apiPath = '/project'; + Future delete() async { + final String apiPath = '/project'; - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update properties of a specific auth method. Use this endpoint to enable or - /// disable a method in your project. - Future updateAuthMethod({required enums.MethodId methodId, required bool enabled}) async { - final String apiPath = '/project/auth-methods/{methodId}'.replaceAll('{methodId}', methodId.value); + /// disable a method in your project. + Future updateAuthMethod( + {required enums.MethodId methodId, required bool enabled}) async { + final String apiPath = '/project/auth-methods/{methodId}' + .replaceAll('{methodId}', methodId.value); final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Get a list of all API keys from the current project. - Future listKeys({List? queries, bool? total}) async { - final String apiPath = '/project/keys'; + Future listKeys({List? queries, bool? total}) async { + final String apiPath = '/project/keys'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.KeyList.fromMap(res.data); - - } + } /// Create a new API key. It's recommended to have multiple API keys with /// strict scopes for separate functions within your project. - /// + /// /// You can also create an ephemeral API key if you need a short-lived key /// instead. - Future createKey({required String keyId, required String name, required List scopes, String? expire}) async { - final String apiPath = '/project/keys'; + Future createKey( + {required String keyId, + required String name, + required List scopes, + String? expire}) async { + final String apiPath = '/project/keys'; final Map apiParams = { - 'keyId': keyId, -'name': name, -'scopes': scopes.map((e) => e.value).toList(), -'expire': expire, - + 'name': name, + 'scopes': scopes.map((e) => e.value).toList(), + 'expire': expire, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Key.fromMap(res.data); - - } + } /// Create a new ephemeral API key. It's recommended to have multiple API keys /// with strict scopes for separate functions within your project. - /// + /// /// You can also create a standard API key if you need a longer-lived key /// instead. - Future createEphemeralKey({required List scopes, required int duration}) async { - final String apiPath = '/project/keys/ephemeral'; + Future createEphemeralKey( + {required List scopes, required int duration}) async { + final String apiPath = '/project/keys/ephemeral'; final Map apiParams = { - 'scopes': scopes.map((e) => e.value).toList(), -'duration': duration, - + 'duration': duration, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.EphemeralKey.fromMap(res.data); + } - } + /// Get a key by its unique ID. + Future getKey({required String keyId}) async { + final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); - /// Get a key by its unique ID. - Future getKey({required String keyId}) async { - final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + final Map apiParams = {}; - final Map apiParams = { - - - }; - - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Key.fromMap(res.data); - - } + } /// Update a key by its unique ID. Use this endpoint to update the name, /// scopes, or expiration time of an API key. - Future updateKey({required String keyId, required String name, required List scopes, String? expire}) async { - final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + Future updateKey( + {required String keyId, + required String name, + required List scopes, + String? expire}) async { + final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); final Map apiParams = { - 'name': name, -'scopes': scopes.map((e) => e.value).toList(), -'expire': expire, - + 'scopes': scopes.map((e) => e.value).toList(), + 'expire': expire, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Key.fromMap(res.data); - - } + } /// Delete a key by its unique ID. Once deleted, the key can no longer be used /// to authenticate API calls. - Future deleteKey({required String keyId}) async { - final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); + Future deleteKey({required String keyId}) async { + final String apiPath = '/project/keys/{keyId}'.replaceAll('{keyId}', keyId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update the project labels. Labels can be used to easily filter projects in /// an organization. - Future updateLabels({required List labels}) async { - final String apiPath = '/project/labels'; + Future updateLabels({required List labels}) async { + final String apiPath = '/project/labels'; final Map apiParams = { - 'labels': labels, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Get a list of all mock phones in the project. This endpoint returns an /// array of all mock phones and their OTPs. - Future listMockPhones({List? queries, bool? total}) async { - final String apiPath = '/project/mock-phones'; + Future listMockPhones( + {List? queries, bool? total}) async { + final String apiPath = '/project/mock-phones'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MockNumberList.fromMap(res.data); - - } + } /// Create a new mock phone for your project. Use this endpoint to register a /// mock phone number and its sign-in OTP for your testers. - Future createMockPhone({required String number, required String otp}) async { - final String apiPath = '/project/mock-phones'; + Future createMockPhone( + {required String number, required String otp}) async { + final String apiPath = '/project/mock-phones'; final Map apiParams = { - 'number': number, -'otp': otp, - + 'otp': otp, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MockNumber.fromMap(res.data); - - } + } /// Get a mock phone by its unique number. This endpoint returns the mock /// phone's OTP. - Future getMockPhone({required String number}) async { - final String apiPath = '/project/mock-phones/{number}'.replaceAll('{number}', number); + Future getMockPhone({required String number}) async { + final String apiPath = + '/project/mock-phones/{number}'.replaceAll('{number}', number); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MockNumber.fromMap(res.data); - - } + } /// Update a mock phone by its unique number. Use this endpoint to update the /// mock phone's OTP. - Future updateMockPhone({required String number, required String otp}) async { - final String apiPath = '/project/mock-phones/{number}'.replaceAll('{number}', number); + Future updateMockPhone( + {required String number, required String otp}) async { + final String apiPath = + '/project/mock-phones/{number}'.replaceAll('{number}', number); final Map apiParams = { - 'otp': otp, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MockNumber.fromMap(res.data); - - } + } /// Delete a mock phone by its unique number. This endpoint removes the mock /// phone and its OTP configuration from the project. - Future deleteMockPhone({required String number}) async { - final String apiPath = '/project/mock-phones/{number}'.replaceAll('{number}', number); + Future deleteMockPhone({required String number}) async { + final String apiPath = + '/project/mock-phones/{number}'.replaceAll('{number}', number); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all OAuth2 providers supported by the server, along with the /// project's configuration for each. Credential fields are write-only and /// always returned empty. - Future listOAuth2Providers({List? queries, bool? total}) async { - final String apiPath = '/project/oauth2'; + Future listOAuth2Providers( + {List? queries, bool? total}) async { + final String apiPath = '/project/oauth2'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2ProviderList.fromMap(res.data); - - } + } /// Get a single OAuth2 provider configuration. Credential fields (client /// secret, p8 file, key/team IDs) are write-only and always returned empty. - Future getOAuth2Provider({required enums.ProviderId providerId}) async { - final String apiPath = '/project/oauth2/:provider'; + Future getOAuth2Provider( + {required enums.ProviderId providerId}) async { + final String apiPath = '/project/oauth2/:provider'; final Map apiParams = { 'providerId': providerId.value, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -483,1273 +445,1226 @@ if (total != null) 'total': total, return models.OAuth2Microsoft.fromMap(response); } - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); }(); - - } + } /// Update the project OAuth2 Amazon configuration. - Future updateOAuth2Amazon({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/amazon'; + Future updateOAuth2Amazon( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/amazon'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Amazon.fromMap(res.data); - - } + } /// Update the project OAuth2 Apple configuration. - Future updateOAuth2Apple({String? serviceId, String? keyId, String? teamId, String? p8File, bool? enabled}) async { - final String apiPath = '/project/oauth2/apple'; + Future updateOAuth2Apple( + {String? serviceId, + String? keyId, + String? teamId, + String? p8File, + bool? enabled}) async { + final String apiPath = '/project/oauth2/apple'; final Map apiParams = { - 'serviceId': serviceId, -'keyId': keyId, -'teamId': teamId, -'p8File': p8File, -'enabled': enabled, - + 'keyId': keyId, + 'teamId': teamId, + 'p8File': p8File, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Apple.fromMap(res.data); - - } + } /// Update the project OAuth2 Auth0 configuration. - Future updateOAuth2Auth0({String? clientId, String? clientSecret, String? endpoint, bool? enabled}) async { - final String apiPath = '/project/oauth2/auth0'; + Future updateOAuth2Auth0( + {String? clientId, + String? clientSecret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/auth0'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'endpoint': endpoint, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Auth0.fromMap(res.data); - - } + } /// Update the project OAuth2 Authentik configuration. - Future updateOAuth2Authentik({String? clientId, String? clientSecret, String? endpoint, bool? enabled}) async { - final String apiPath = '/project/oauth2/authentik'; + Future updateOAuth2Authentik( + {String? clientId, + String? clientSecret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/authentik'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'endpoint': endpoint, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Authentik.fromMap(res.data); - - } + } /// Update the project OAuth2 Autodesk configuration. - Future updateOAuth2Autodesk({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/autodesk'; + Future updateOAuth2Autodesk( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/autodesk'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Autodesk.fromMap(res.data); - - } + } /// Update the project OAuth2 Bitbucket configuration. - Future updateOAuth2Bitbucket({String? key, String? secret, bool? enabled}) async { - final String apiPath = '/project/oauth2/bitbucket'; + Future updateOAuth2Bitbucket( + {String? key, String? secret, bool? enabled}) async { + final String apiPath = '/project/oauth2/bitbucket'; final Map apiParams = { - 'key': key, -'secret': secret, -'enabled': enabled, - + 'secret': secret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Bitbucket.fromMap(res.data); - - } + } /// Update the project OAuth2 Bitly configuration. - Future updateOAuth2Bitly({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/bitly'; + Future updateOAuth2Bitly( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/bitly'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Bitly.fromMap(res.data); - - } + } /// Update the project OAuth2 Box configuration. - Future updateOAuth2Box({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/box'; + Future updateOAuth2Box( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/box'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Box.fromMap(res.data); - - } + } /// Update the project OAuth2 Dailymotion configuration. - Future updateOAuth2Dailymotion({String? apiKey, String? apiSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/dailymotion'; + Future updateOAuth2Dailymotion( + {String? apiKey, String? apiSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/dailymotion'; final Map apiParams = { - 'apiKey': apiKey, -'apiSecret': apiSecret, -'enabled': enabled, - + 'apiSecret': apiSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Dailymotion.fromMap(res.data); - - } + } /// Update the project OAuth2 Discord configuration. - Future updateOAuth2Discord({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/discord'; + Future updateOAuth2Discord( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/discord'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Discord.fromMap(res.data); - - } + } /// Update the project OAuth2 Disqus configuration. - Future updateOAuth2Disqus({String? publicKey, String? secretKey, bool? enabled}) async { - final String apiPath = '/project/oauth2/disqus'; + Future updateOAuth2Disqus( + {String? publicKey, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/disqus'; final Map apiParams = { - 'publicKey': publicKey, -'secretKey': secretKey, -'enabled': enabled, - + 'secretKey': secretKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Disqus.fromMap(res.data); - - } + } /// Update the project OAuth2 Dropbox configuration. - Future updateOAuth2Dropbox({String? appKey, String? appSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/dropbox'; + Future updateOAuth2Dropbox( + {String? appKey, String? appSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/dropbox'; final Map apiParams = { - 'appKey': appKey, -'appSecret': appSecret, -'enabled': enabled, - + 'appSecret': appSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Dropbox.fromMap(res.data); - - } + } /// Update the project OAuth2 Etsy configuration. - Future updateOAuth2Etsy({String? keyString, String? sharedSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/etsy'; + Future updateOAuth2Etsy( + {String? keyString, String? sharedSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/etsy'; final Map apiParams = { - 'keyString': keyString, -'sharedSecret': sharedSecret, -'enabled': enabled, - + 'sharedSecret': sharedSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Etsy.fromMap(res.data); - - } + } /// Update the project OAuth2 Facebook configuration. - Future updateOAuth2Facebook({String? appId, String? appSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/facebook'; + Future updateOAuth2Facebook( + {String? appId, String? appSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/facebook'; final Map apiParams = { - 'appId': appId, -'appSecret': appSecret, -'enabled': enabled, - + 'appSecret': appSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Facebook.fromMap(res.data); - - } + } /// Update the project OAuth2 Figma configuration. - Future updateOAuth2Figma({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/figma'; + Future updateOAuth2Figma( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/figma'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Figma.fromMap(res.data); - - } + } /// Update the project OAuth2 FusionAuth configuration. - Future updateOAuth2FusionAuth({String? clientId, String? clientSecret, String? endpoint, bool? enabled}) async { - final String apiPath = '/project/oauth2/fusionauth'; + Future updateOAuth2FusionAuth( + {String? clientId, + String? clientSecret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/fusionauth'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'endpoint': endpoint, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2FusionAuth.fromMap(res.data); - - } + } /// Update the project OAuth2 GitHub configuration. - Future updateOAuth2GitHub({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/github'; + Future updateOAuth2GitHub( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/github'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Github.fromMap(res.data); - - } + } /// Update the project OAuth2 Gitlab configuration. - Future updateOAuth2Gitlab({String? applicationId, String? secret, String? endpoint, bool? enabled}) async { - final String apiPath = '/project/oauth2/gitlab'; + Future updateOAuth2Gitlab( + {String? applicationId, + String? secret, + String? endpoint, + bool? enabled}) async { + final String apiPath = '/project/oauth2/gitlab'; final Map apiParams = { - 'applicationId': applicationId, -'secret': secret, -'endpoint': endpoint, -'enabled': enabled, - + 'secret': secret, + 'endpoint': endpoint, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Gitlab.fromMap(res.data); - - } + } /// Update the project OAuth2 Google configuration. - Future updateOAuth2Google({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/google'; + Future updateOAuth2Google( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/google'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Google.fromMap(res.data); - - } + } /// Update the project OAuth2 Keycloak configuration. - Future updateOAuth2Keycloak({String? clientId, String? clientSecret, String? endpoint, String? realmName, bool? enabled}) async { - final String apiPath = '/project/oauth2/keycloak'; + Future updateOAuth2Keycloak( + {String? clientId, + String? clientSecret, + String? endpoint, + String? realmName, + bool? enabled}) async { + final String apiPath = '/project/oauth2/keycloak'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'endpoint': endpoint, -'realmName': realmName, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'endpoint': endpoint, + 'realmName': realmName, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Keycloak.fromMap(res.data); - - } + } /// Update the project OAuth2 Kick configuration. - Future updateOAuth2Kick({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/kick'; + Future updateOAuth2Kick( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/kick'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Kick.fromMap(res.data); - - } + } /// Update the project OAuth2 Linkedin configuration. - Future updateOAuth2Linkedin({String? clientId, String? primaryClientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/linkedin'; + Future updateOAuth2Linkedin( + {String? clientId, String? primaryClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/linkedin'; final Map apiParams = { - 'clientId': clientId, -'primaryClientSecret': primaryClientSecret, -'enabled': enabled, - + 'primaryClientSecret': primaryClientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Linkedin.fromMap(res.data); - - } + } /// Update the project OAuth2 Microsoft configuration. - Future updateOAuth2Microsoft({String? applicationId, String? applicationSecret, String? tenant, bool? enabled}) async { - final String apiPath = '/project/oauth2/microsoft'; + Future updateOAuth2Microsoft( + {String? applicationId, + String? applicationSecret, + String? tenant, + bool? enabled}) async { + final String apiPath = '/project/oauth2/microsoft'; final Map apiParams = { - 'applicationId': applicationId, -'applicationSecret': applicationSecret, -'tenant': tenant, -'enabled': enabled, - + 'applicationSecret': applicationSecret, + 'tenant': tenant, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Microsoft.fromMap(res.data); - - } + } /// Update the project OAuth2 Notion configuration. - Future updateOAuth2Notion({String? oauthClientId, String? oauthClientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/notion'; + Future updateOAuth2Notion( + {String? oauthClientId, String? oauthClientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/notion'; final Map apiParams = { - 'oauthClientId': oauthClientId, -'oauthClientSecret': oauthClientSecret, -'enabled': enabled, - + 'oauthClientSecret': oauthClientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Notion.fromMap(res.data); - - } + } /// Update the project OAuth2 Oidc configuration. - Future updateOAuth2Oidc({String? clientId, String? clientSecret, String? wellKnownURL, String? authorizationURL, String? tokenURL, String? userInfoURL, bool? enabled}) async { - final String apiPath = '/project/oauth2/oidc'; + Future updateOAuth2Oidc( + {String? clientId, + String? clientSecret, + String? wellKnownURL, + String? authorizationURL, + String? tokenURL, + String? userInfoURL, + bool? enabled}) async { + final String apiPath = '/project/oauth2/oidc'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'wellKnownURL': wellKnownURL, -'authorizationURL': authorizationURL, -'tokenURL': tokenURL, -'userInfoURL': userInfoURL, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'wellKnownURL': wellKnownURL, + 'authorizationURL': authorizationURL, + 'tokenURL': tokenURL, + 'userInfoURL': userInfoURL, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Oidc.fromMap(res.data); - - } + } /// Update the project OAuth2 Okta configuration. - Future updateOAuth2Okta({String? clientId, String? clientSecret, String? domain, String? authorizationServerId, bool? enabled}) async { - final String apiPath = '/project/oauth2/okta'; + Future updateOAuth2Okta( + {String? clientId, + String? clientSecret, + String? domain, + String? authorizationServerId, + bool? enabled}) async { + final String apiPath = '/project/oauth2/okta'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'domain': domain, -'authorizationServerId': authorizationServerId, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'domain': domain, + 'authorizationServerId': authorizationServerId, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Okta.fromMap(res.data); - - } + } /// Update the project OAuth2 Paypal configuration. - Future updateOAuth2Paypal({String? clientId, String? secretKey, bool? enabled}) async { - final String apiPath = '/project/oauth2/paypal'; + Future updateOAuth2Paypal( + {String? clientId, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/paypal'; final Map apiParams = { - 'clientId': clientId, -'secretKey': secretKey, -'enabled': enabled, - + 'secretKey': secretKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Paypal.fromMap(res.data); - - } + } /// Update the project OAuth2 PaypalSandbox configuration. - Future updateOAuth2PaypalSandbox({String? clientId, String? secretKey, bool? enabled}) async { - final String apiPath = '/project/oauth2/paypalSandbox'; + Future updateOAuth2PaypalSandbox( + {String? clientId, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/paypalSandbox'; final Map apiParams = { - 'clientId': clientId, -'secretKey': secretKey, -'enabled': enabled, - + 'secretKey': secretKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Paypal.fromMap(res.data); - - } + } /// Update the project OAuth2 Podio configuration. - Future updateOAuth2Podio({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/podio'; + Future updateOAuth2Podio( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/podio'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Podio.fromMap(res.data); - - } + } /// Update the project OAuth2 Salesforce configuration. - Future updateOAuth2Salesforce({String? customerKey, String? customerSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/salesforce'; + Future updateOAuth2Salesforce( + {String? customerKey, String? customerSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/salesforce'; final Map apiParams = { - 'customerKey': customerKey, -'customerSecret': customerSecret, -'enabled': enabled, - + 'customerSecret': customerSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Salesforce.fromMap(res.data); - - } + } /// Update the project OAuth2 Slack configuration. - Future updateOAuth2Slack({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/slack'; + Future updateOAuth2Slack( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/slack'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Slack.fromMap(res.data); - - } + } /// Update the project OAuth2 Spotify configuration. - Future updateOAuth2Spotify({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/spotify'; + Future updateOAuth2Spotify( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/spotify'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Spotify.fromMap(res.data); - - } + } /// Update the project OAuth2 Stripe configuration. - Future updateOAuth2Stripe({String? clientId, String? apiSecretKey, bool? enabled}) async { - final String apiPath = '/project/oauth2/stripe'; + Future updateOAuth2Stripe( + {String? clientId, String? apiSecretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/stripe'; final Map apiParams = { - 'clientId': clientId, -'apiSecretKey': apiSecretKey, -'enabled': enabled, - + 'apiSecretKey': apiSecretKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Stripe.fromMap(res.data); - - } + } /// Update the project OAuth2 Tradeshift configuration. - Future updateOAuth2Tradeshift({String? oauth2ClientId, String? oauth2ClientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/tradeshift'; + Future updateOAuth2Tradeshift( + {String? oauth2ClientId, + String? oauth2ClientSecret, + bool? enabled}) async { + final String apiPath = '/project/oauth2/tradeshift'; final Map apiParams = { - 'oauth2ClientId': oauth2ClientId, -'oauth2ClientSecret': oauth2ClientSecret, -'enabled': enabled, - + 'oauth2ClientSecret': oauth2ClientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Tradeshift.fromMap(res.data); - - } + } /// Update the project OAuth2 Tradeshift Sandbox configuration. - Future updateOAuth2TradeshiftSandbox({String? oauth2ClientId, String? oauth2ClientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/tradeshiftBox'; + Future updateOAuth2TradeshiftSandbox( + {String? oauth2ClientId, + String? oauth2ClientSecret, + bool? enabled}) async { + final String apiPath = '/project/oauth2/tradeshiftBox'; final Map apiParams = { - 'oauth2ClientId': oauth2ClientId, -'oauth2ClientSecret': oauth2ClientSecret, -'enabled': enabled, - + 'oauth2ClientSecret': oauth2ClientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Tradeshift.fromMap(res.data); - - } + } /// Update the project OAuth2 Twitch configuration. - Future updateOAuth2Twitch({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/twitch'; + Future updateOAuth2Twitch( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/twitch'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Twitch.fromMap(res.data); - - } + } /// Update the project OAuth2 WordPress configuration. - Future updateOAuth2WordPress({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/wordpress'; + Future updateOAuth2WordPress( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/wordpress'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2WordPress.fromMap(res.data); - - } + } /// Update the project OAuth2 X configuration. - Future updateOAuth2X({String? customerKey, String? secretKey, bool? enabled}) async { - final String apiPath = '/project/oauth2/x'; + Future updateOAuth2X( + {String? customerKey, String? secretKey, bool? enabled}) async { + final String apiPath = '/project/oauth2/x'; final Map apiParams = { - 'customerKey': customerKey, -'secretKey': secretKey, -'enabled': enabled, - + 'secretKey': secretKey, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2X.fromMap(res.data); - - } + } /// Update the project OAuth2 Yahoo configuration. - Future updateOAuth2Yahoo({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/yahoo'; + Future updateOAuth2Yahoo( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/yahoo'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Yahoo.fromMap(res.data); - - } + } /// Update the project OAuth2 Yandex configuration. - Future updateOAuth2Yandex({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/yandex'; + Future updateOAuth2Yandex( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/yandex'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Yandex.fromMap(res.data); - - } + } /// Update the project OAuth2 Zoho configuration. - Future updateOAuth2Zoho({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/zoho'; + Future updateOAuth2Zoho( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/zoho'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Zoho.fromMap(res.data); - - } + } /// Update the project OAuth2 Zoom configuration. - Future updateOAuth2Zoom({String? clientId, String? clientSecret, bool? enabled}) async { - final String apiPath = '/project/oauth2/zoom'; + Future updateOAuth2Zoom( + {String? clientId, String? clientSecret, bool? enabled}) async { + final String apiPath = '/project/oauth2/zoom'; final Map apiParams = { - 'clientId': clientId, -'clientSecret': clientSecret, -'enabled': enabled, - + 'clientSecret': clientSecret, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.OAuth2Zoom.fromMap(res.data); - - } + } /// Get a list of all platforms in the project. This endpoint returns an array /// of all platforms and their configurations. - Future listPlatforms({List? queries, bool? total}) async { - final String apiPath = '/project/platforms'; + Future listPlatforms( + {List? queries, bool? total}) async { + final String apiPath = '/project/platforms'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformList.fromMap(res.data); - - } + } /// Create a new Android platform for your project. Use this endpoint to /// register a new Android platform where your users will run your application /// which will interact with the Appwrite API. - Future createAndroidPlatform({required String platformId, required String name, required String applicationId}) async { - final String apiPath = '/project/platforms/android'; + Future createAndroidPlatform( + {required String platformId, + required String name, + required String applicationId}) async { + final String apiPath = '/project/platforms/android'; final Map apiParams = { - 'platformId': platformId, -'name': name, -'applicationId': applicationId, - + 'name': name, + 'applicationId': applicationId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformAndroid.fromMap(res.data); - - } + } /// Update an Android platform by its unique ID. Use this endpoint to update /// the platform's name or application ID. - Future updateAndroidPlatform({required String platformId, required String name, required String applicationId}) async { - final String apiPath = '/project/platforms/android/{platformId}'.replaceAll('{platformId}', platformId); + Future updateAndroidPlatform( + {required String platformId, + required String name, + required String applicationId}) async { + final String apiPath = '/project/platforms/android/{platformId}' + .replaceAll('{platformId}', platformId); final Map apiParams = { - 'name': name, -'applicationId': applicationId, - + 'applicationId': applicationId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformAndroid.fromMap(res.data); - - } + } /// Create a new Apple platform for your project. Use this endpoint to register /// a new Apple platform where your users will run your application which will /// interact with the Appwrite API. - Future createApplePlatform({required String platformId, required String name, required String bundleIdentifier}) async { - final String apiPath = '/project/platforms/apple'; + Future createApplePlatform( + {required String platformId, + required String name, + required String bundleIdentifier}) async { + final String apiPath = '/project/platforms/apple'; final Map apiParams = { - 'platformId': platformId, -'name': name, -'bundleIdentifier': bundleIdentifier, - + 'name': name, + 'bundleIdentifier': bundleIdentifier, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformApple.fromMap(res.data); - - } + } /// Update an Apple platform by its unique ID. Use this endpoint to update the /// platform's name or bundle identifier. - Future updateApplePlatform({required String platformId, required String name, required String bundleIdentifier}) async { - final String apiPath = '/project/platforms/apple/{platformId}'.replaceAll('{platformId}', platformId); + Future updateApplePlatform( + {required String platformId, + required String name, + required String bundleIdentifier}) async { + final String apiPath = '/project/platforms/apple/{platformId}' + .replaceAll('{platformId}', platformId); final Map apiParams = { - 'name': name, -'bundleIdentifier': bundleIdentifier, - + 'bundleIdentifier': bundleIdentifier, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformApple.fromMap(res.data); - - } + } /// Create a new Linux platform for your project. Use this endpoint to register /// a new Linux platform where your users will run your application which will /// interact with the Appwrite API. - Future createLinuxPlatform({required String platformId, required String name, required String packageName}) async { - final String apiPath = '/project/platforms/linux'; + Future createLinuxPlatform( + {required String platformId, + required String name, + required String packageName}) async { + final String apiPath = '/project/platforms/linux'; final Map apiParams = { - 'platformId': platformId, -'name': name, -'packageName': packageName, - + 'name': name, + 'packageName': packageName, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformLinux.fromMap(res.data); - - } + } /// Update a Linux platform by its unique ID. Use this endpoint to update the /// platform's name or package name. - Future updateLinuxPlatform({required String platformId, required String name, required String packageName}) async { - final String apiPath = '/project/platforms/linux/{platformId}'.replaceAll('{platformId}', platformId); + Future updateLinuxPlatform( + {required String platformId, + required String name, + required String packageName}) async { + final String apiPath = '/project/platforms/linux/{platformId}' + .replaceAll('{platformId}', platformId); final Map apiParams = { - 'name': name, -'packageName': packageName, - + 'packageName': packageName, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformLinux.fromMap(res.data); - - } + } /// Create a new web platform for your project. Use this endpoint to register a /// new platform where your users will run your application which will interact /// with the Appwrite API. - Future createWebPlatform({required String platformId, required String name, required String hostname}) async { - final String apiPath = '/project/platforms/web'; + Future createWebPlatform( + {required String platformId, + required String name, + required String hostname}) async { + final String apiPath = '/project/platforms/web'; final Map apiParams = { - 'platformId': platformId, -'name': name, -'hostname': hostname, - + 'name': name, + 'hostname': hostname, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformWeb.fromMap(res.data); - - } + } /// Update a web platform by its unique ID. Use this endpoint to update the /// platform's name or hostname. - Future updateWebPlatform({required String platformId, required String name, required String hostname}) async { - final String apiPath = '/project/platforms/web/{platformId}'.replaceAll('{platformId}', platformId); + Future updateWebPlatform( + {required String platformId, + required String name, + required String hostname}) async { + final String apiPath = '/project/platforms/web/{platformId}' + .replaceAll('{platformId}', platformId); final Map apiParams = { - 'name': name, -'hostname': hostname, - + 'hostname': hostname, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformWeb.fromMap(res.data); - - } + } /// Create a new Windows platform for your project. Use this endpoint to /// register a new Windows platform where your users will run your application /// which will interact with the Appwrite API. - Future createWindowsPlatform({required String platformId, required String name, required String packageIdentifierName}) async { - final String apiPath = '/project/platforms/windows'; + Future createWindowsPlatform( + {required String platformId, + required String name, + required String packageIdentifierName}) async { + final String apiPath = '/project/platforms/windows'; final Map apiParams = { - 'platformId': platformId, -'name': name, -'packageIdentifierName': packageIdentifierName, - + 'name': name, + 'packageIdentifierName': packageIdentifierName, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformWindows.fromMap(res.data); - - } + } /// Update a Windows platform by its unique ID. Use this endpoint to update the /// platform's name or package identifier name. - Future updateWindowsPlatform({required String platformId, required String name, required String packageIdentifierName}) async { - final String apiPath = '/project/platforms/windows/{platformId}'.replaceAll('{platformId}', platformId); + Future updateWindowsPlatform( + {required String platformId, + required String name, + required String packageIdentifierName}) async { + final String apiPath = '/project/platforms/windows/{platformId}' + .replaceAll('{platformId}', platformId); final Map apiParams = { - 'name': name, -'packageIdentifierName': packageIdentifierName, - + 'packageIdentifierName': packageIdentifierName, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PlatformWindows.fromMap(res.data); - - } + } /// Get a platform by its unique ID. This endpoint returns the platform's /// details, including its name, type, and key configurations. - Future getPlatform({required String platformId}) async { - final String apiPath = '/project/platforms/{platformId}'.replaceAll('{platformId}', platformId); + Future getPlatform({required String platformId}) async { + final String apiPath = '/project/platforms/{platformId}' + .replaceAll('{platformId}', platformId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -1769,290 +1684,266 @@ if (total != null) 'total': total, return models.PlatformLinux.fromMap(response); } - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); }(); - - } + } /// Delete a platform by its unique ID. This endpoint removes the platform and /// all its configurations from the project. - Future deletePlatform({required String platformId}) async { - final String apiPath = '/project/platforms/{platformId}'.replaceAll('{platformId}', platformId); + Future deletePlatform({required String platformId}) async { + final String apiPath = '/project/platforms/{platformId}' + .replaceAll('{platformId}', platformId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all project policies and their current configuration. - Future listPolicies({List? queries, bool? total}) async { - final String apiPath = '/project/policies'; + Future listPolicies( + {List? queries, bool? total}) async { + final String apiPath = '/project/policies'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.PolicyList.fromMap(res.data); - - } + } /// Updating this policy allows you to control if team members can see other /// members information. When enabled, all team members can see ID, name, /// email, phone number, and MFA status of other members.. - Future updateMembershipPrivacyPolicy({bool? userId, bool? userEmail, bool? userPhone, bool? userName, bool? userMFA}) async { - final String apiPath = '/project/policies/membership-privacy'; + Future updateMembershipPrivacyPolicy( + {bool? userId, + bool? userEmail, + bool? userPhone, + bool? userName, + bool? userMFA}) async { + final String apiPath = '/project/policies/membership-privacy'; final Map apiParams = { - if (userId != null) 'userId': userId, -if (userEmail != null) 'userEmail': userEmail, -if (userPhone != null) 'userPhone': userPhone, -if (userName != null) 'userName': userName, -if (userMFA != null) 'userMFA': userMFA, - + if (userEmail != null) 'userEmail': userEmail, + if (userPhone != null) 'userPhone': userPhone, + if (userName != null) 'userName': userName, + if (userMFA != null) 'userMFA': userMFA, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Updating this policy allows you to control if new passwords are checked /// against most common passwords dictionary. When enabled, and user changes /// their password, password must not be contained in the dictionary. - Future updatePasswordDictionaryPolicy({required bool enabled}) async { - final String apiPath = '/project/policies/password-dictionary'; + Future updatePasswordDictionaryPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/password-dictionary'; final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Updates one of password strength policies. Based on total length /// configured, previous password hashes are stored, and users cannot choose a /// new password that is already stored in the passwird history list, when /// updating an user password, or setting new one through password recovery. - /// + /// /// Keep in mind, while password history policy is disabled, the history is not /// being stored. Enabling the policy will not have any history on existing /// users, and it will only start to collect and enforce the policy on password /// changes since the policy is enabled. - Future updatePasswordHistoryPolicy({required int? total}) async { - final String apiPath = '/project/policies/password-history'; + Future updatePasswordHistoryPolicy( + {required int? total}) async { + final String apiPath = '/project/policies/password-history'; final Map apiParams = { - 'total': total, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Updating this policy allows you to control if password strength is checked /// against personal data. When enabled, and user sets or changes their /// password, the password must not contain user ID, name, email or phone /// number. - Future updatePasswordPersonalDataPolicy({required bool enabled}) async { - final String apiPath = '/project/policies/password-personal-data'; + Future updatePasswordPersonalDataPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/password-personal-data'; final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Updating this policy allows you to control if email alert is sent upon /// session creation. When enabled, and user signs into their account, they /// will be sent an email notification. There is an exception, the first /// session after a new sign up does not trigger an alert, even if the policy /// is enabled. - Future updateSessionAlertPolicy({required bool enabled}) async { - final String apiPath = '/project/policies/session-alert'; + Future updateSessionAlertPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/session-alert'; final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Update maximum duration how long sessions created within a project should /// stay active for. - Future updateSessionDurationPolicy({required int duration}) async { - final String apiPath = '/project/policies/session-duration'; + Future updateSessionDurationPolicy( + {required int duration}) async { + final String apiPath = '/project/policies/session-duration'; final Map apiParams = { - 'duration': duration, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Updating this policy allows you to control if existing sessions should be /// invalidated when a password of a user is changed. When enabled, and user /// changes their password, they will be logged out of all their devices. - Future updateSessionInvalidationPolicy({required bool enabled}) async { - final String apiPath = '/project/policies/session-invalidation'; + Future updateSessionInvalidationPolicy( + {required bool enabled}) async { + final String apiPath = '/project/policies/session-invalidation'; final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Update the maximum number of sessions allowed per user. When the limit is /// hit, the oldest session will be deleted to make room for new one. - Future updateSessionLimitPolicy({required int? total}) async { - final String apiPath = '/project/policies/session-limit'; + Future updateSessionLimitPolicy({required int? total}) async { + final String apiPath = '/project/policies/session-limit'; final Map apiParams = { - 'total': total, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Update the maximum number of users in the project. When the limit is hit or /// amount of existing users already exceeded the limit, all users remain /// active, but new user sign up will be prohibited. - Future updateUserLimitPolicy({required int? total}) async { - final String apiPath = '/project/policies/user-limit'; + Future updateUserLimitPolicy({required int? total}) async { + final String apiPath = '/project/policies/user-limit'; final Map apiParams = { - 'total': total, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Get a policy by its unique ID. This endpoint returns the current /// configuration for the requested project policy. - Future getPolicy({required enums.PolicyId policyId}) async { - final String apiPath = '/project/policies/{policyId}'.replaceAll('{policyId}', policyId.value); + Future getPolicy({required enums.PolicyId policyId}) async { + final String apiPath = + '/project/policies/{policyId}'.replaceAll('{policyId}', policyId.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -2084,287 +1975,283 @@ if (userMFA != null) 'userMFA': userMFA, return models.PolicyMembershipPrivacy.fromMap(response); } - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); }(); - - } + } /// Update properties of a specific protocol. Use this endpoint to enable or - /// disable a protocol in your project. - Future updateProtocol({required enums.ProtocolId protocolId, required bool enabled}) async { - final String apiPath = '/project/protocols/{protocolId}'.replaceAll('{protocolId}', protocolId.value); + /// disable a protocol in your project. + Future updateProtocol( + {required enums.ProtocolId protocolId, required bool enabled}) async { + final String apiPath = '/project/protocols/{protocolId}' + .replaceAll('{protocolId}', protocolId.value); final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Update properties of a specific service. Use this endpoint to enable or - /// disable a service in your project. - Future updateService({required enums.ServiceId serviceId, required bool enabled}) async { - final String apiPath = '/project/services/{serviceId}'.replaceAll('{serviceId}', serviceId.value); + /// disable a service in your project. + Future updateService( + {required enums.ServiceId serviceId, required bool enabled}) async { + final String apiPath = '/project/services/{serviceId}' + .replaceAll('{serviceId}', serviceId.value); final Map apiParams = { - 'enabled': enabled, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); - - } + } /// Update the SMTP configuration for your project. Use this endpoint to /// configure your project's SMTP provider with your custom settings for /// sending transactional emails. - Future updateSMTP({String? host, int? port, String? username, String? password, String? senderEmail, String? senderName, String? replyToEmail, String? replyToName, enums.Secure? secure, bool? enabled}) async { - final String apiPath = '/project/smtp'; + Future updateSMTP( + {String? host, + int? port, + String? username, + String? password, + String? senderEmail, + String? senderName, + String? replyToEmail, + String? replyToName, + enums.Secure? secure, + bool? enabled}) async { + final String apiPath = '/project/smtp'; final Map apiParams = { - 'host': host, -'port': port, -'username': username, -'password': password, -'senderEmail': senderEmail, -'senderName': senderName, -'replyToEmail': replyToEmail, -'replyToName': replyToName, -'secure': secure?.value, -'enabled': enabled, - + 'port': port, + 'username': username, + 'password': password, + 'senderEmail': senderEmail, + 'senderName': senderName, + 'replyToEmail': replyToEmail, + 'replyToName': replyToName, + 'secure': secure?.value, + 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Project.fromMap(res.data); + } - } - - /// Send a test email to verify SMTP configuration. - Future createSMTPTest({required List emails}) async { - final String apiPath = '/project/smtp/tests'; + /// Send a test email to verify SMTP configuration. + Future createSMTPTest({required List emails}) async { + final String apiPath = '/project/smtp/tests'; final Map apiParams = { - 'emails': emails, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all custom email templates configured for the project. This /// endpoint returns an array of all configured email templates and their /// locales. - Future listEmailTemplates({List? queries, bool? total}) async { - final String apiPath = '/project/templates/email'; + Future listEmailTemplates( + {List? queries, bool? total}) async { + final String apiPath = '/project/templates/email'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.EmailTemplateList.fromMap(res.data); - - } + } /// Update a custom email template for the specified locale and type. Use this /// endpoint to modify the content of your email templates. - Future updateEmailTemplate({required enums.EmailTemplateType templateId, enums.EmailTemplateLocale? locale, String? subject, String? message, String? senderName, String? senderEmail, String? replyToEmail, String? replyToName}) async { - final String apiPath = '/project/templates/email'; + Future updateEmailTemplate( + {required enums.EmailTemplateType templateId, + enums.EmailTemplateLocale? locale, + String? subject, + String? message, + String? senderName, + String? senderEmail, + String? replyToEmail, + String? replyToName}) async { + final String apiPath = '/project/templates/email'; final Map apiParams = { - 'templateId': templateId.value, -if (locale != null) 'locale': locale.value, -'subject': subject, -'message': message, -'senderName': senderName, -'senderEmail': senderEmail, -'replyToEmail': replyToEmail, -'replyToName': replyToName, - + if (locale != null) 'locale': locale.value, + 'subject': subject, + 'message': message, + 'senderName': senderName, + 'senderEmail': senderEmail, + 'replyToEmail': replyToEmail, + 'replyToName': replyToName, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.EmailTemplate.fromMap(res.data); - - } + } /// Get a custom email template for the specified locale and type. This /// endpoint returns the template content, subject, and other configuration /// details. - Future getEmailTemplate({required enums.EmailTemplateType templateId, enums.EmailTemplateLocale? locale}) async { - final String apiPath = '/project/templates/email/{templateId}'.replaceAll('{templateId}', templateId.value); + Future getEmailTemplate( + {required enums.EmailTemplateType templateId, + enums.EmailTemplateLocale? locale}) async { + final String apiPath = '/project/templates/email/{templateId}' + .replaceAll('{templateId}', templateId.value); final Map apiParams = { if (locale != null) 'locale': locale.value, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.EmailTemplate.fromMap(res.data); - - } + } /// Get a list of all project environment variables. - Future listVariables({List? queries, bool? total}) async { - final String apiPath = '/project/variables'; + Future listVariables( + {List? queries, bool? total}) async { + final String apiPath = '/project/variables'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.VariableList.fromMap(res.data); - - } + } /// Create a new project environment variable. These variables can be accessed /// by all functions and sites in the project. - Future createVariable({required String variableId, required String key, required String value, bool? secret}) async { - final String apiPath = '/project/variables'; + Future createVariable( + {required String variableId, + required String key, + required String value, + bool? secret}) async { + final String apiPath = '/project/variables'; final Map apiParams = { - 'variableId': variableId, -'key': key, -'value': value, -if (secret != null) 'secret': secret, - + 'key': key, + 'value': value, + if (secret != null) 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); + } - } + /// Get a variable by its unique ID. + Future getVariable({required String variableId}) async { + final String apiPath = '/project/variables/{variableId}' + .replaceAll('{variableId}', variableId); - /// Get a variable by its unique ID. - Future getVariable({required String variableId}) async { - final String apiPath = '/project/variables/{variableId}'.replaceAll('{variableId}', variableId); - - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Update variable by its unique ID. - Future updateVariable({required String variableId, String? key, String? value, bool? secret}) async { - final String apiPath = '/project/variables/{variableId}'.replaceAll('{variableId}', variableId); + Future updateVariable( + {required String variableId, + String? key, + String? value, + bool? secret}) async { + final String apiPath = '/project/variables/{variableId}' + .replaceAll('{variableId}', variableId); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); + } - } + /// Delete a variable by its unique ID. + Future deleteVariable({required String variableId}) async { + final String apiPath = '/project/variables/{variableId}' + .replaceAll('{variableId}', variableId); - /// Delete a variable by its unique ID. - Future deleteVariable({required String variableId}) async { - final String apiPath = '/project/variables/{variableId}'.replaceAll('{variableId}', variableId); - - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/proxy.dart b/lib/services/proxy.dart index 1871d56a..7780e710 100644 --- a/lib/services/proxy.dart +++ b/lib/services/proxy.dart @@ -1,196 +1,180 @@ part of '../dart_appwrite.dart'; - /// The Proxy Service allows you to configure actions for your domains beyond - /// DNS configuration. +/// The Proxy Service allows you to configure actions for your domains beyond +/// DNS configuration. class Proxy extends Service { - Proxy(super.client); + Proxy(super.client); /// Get a list of all the proxy rules. You can use the query params to filter /// your results. - Future listRules({List? queries, bool? total}) async { - final String apiPath = '/proxy/rules'; + Future listRules( + {List? queries, bool? total}) async { + final String apiPath = '/proxy/rules'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRuleList.fromMap(res.data); - - } + } /// Create a new proxy rule for serving Appwrite's API on custom domain. - /// + /// /// Rule ID is automatically generated as MD5 hash of a rule domain for /// performance purposes. - Future createAPIRule({required String domain}) async { - final String apiPath = '/proxy/rules/api'; + Future createAPIRule({required String domain}) async { + final String apiPath = '/proxy/rules/api'; final Map apiParams = { - 'domain': domain, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRule.fromMap(res.data); - - } + } /// Create a new proxy rule for executing Appwrite Function on custom domain. - /// + /// /// Rule ID is automatically generated as MD5 hash of a rule domain for /// performance purposes. - Future createFunctionRule({required String domain, required String functionId, String? branch}) async { - final String apiPath = '/proxy/rules/function'; + Future createFunctionRule( + {required String domain, + required String functionId, + String? branch}) async { + final String apiPath = '/proxy/rules/function'; final Map apiParams = { - 'domain': domain, -'functionId': functionId, -if (branch != null) 'branch': branch, - + 'functionId': functionId, + if (branch != null) 'branch': branch, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRule.fromMap(res.data); - - } + } /// Create a new proxy rule for to redirect from custom domain to another /// domain. - /// + /// /// Rule ID is automatically generated as MD5 hash of a rule domain for /// performance purposes. - Future createRedirectRule({required String domain, required String url, required enums.StatusCode statusCode, required String resourceId, required enums.ProxyResourceType resourceType}) async { - final String apiPath = '/proxy/rules/redirect'; + Future createRedirectRule( + {required String domain, + required String url, + required enums.StatusCode statusCode, + required String resourceId, + required enums.ProxyResourceType resourceType}) async { + final String apiPath = '/proxy/rules/redirect'; final Map apiParams = { - 'domain': domain, -'url': url, -'statusCode': statusCode.value, -'resourceId': resourceId, -'resourceType': resourceType.value, - + 'url': url, + 'statusCode': statusCode.value, + 'resourceId': resourceId, + 'resourceType': resourceType.value, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRule.fromMap(res.data); - - } + } /// Create a new proxy rule for serving Appwrite Site on custom domain. - /// + /// /// Rule ID is automatically generated as MD5 hash of a rule domain for /// performance purposes. - Future createSiteRule({required String domain, required String siteId, String? branch}) async { - final String apiPath = '/proxy/rules/site'; + Future createSiteRule( + {required String domain, required String siteId, String? branch}) async { + final String apiPath = '/proxy/rules/site'; final Map apiParams = { - 'domain': domain, -'siteId': siteId, -if (branch != null) 'branch': branch, - + 'siteId': siteId, + if (branch != null) 'branch': branch, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRule.fromMap(res.data); - - } + } /// Get a proxy rule by its unique ID. - Future getRule({required String ruleId}) async { - final String apiPath = '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); + Future getRule({required String ruleId}) async { + final String apiPath = + '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRule.fromMap(res.data); - - } + } /// Delete a proxy rule by its unique ID. - Future deleteRule({required String ruleId}) async { - final String apiPath = '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); + Future deleteRule({required String ruleId}) async { + final String apiPath = + '/proxy/rules/{ruleId}'.replaceAll('{ruleId}', ruleId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// If not succeeded yet, retry verification process of a proxy rule domain. /// This endpoint triggers domain verification by checking DNS records. If /// verification is successful, a TLS certificate will be automatically /// provisioned for the domain asynchronously in the background. - Future updateRuleStatus({required String ruleId}) async { - final String apiPath = '/proxy/rules/{ruleId}/status'.replaceAll('{ruleId}', ruleId); + Future updateRuleStatus({required String ruleId}) async { + final String apiPath = + '/proxy/rules/{ruleId}/status'.replaceAll('{ruleId}', ruleId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ProxyRule.fromMap(res.data); - - } + } } diff --git a/lib/services/sites.dart b/lib/services/sites.dart index 31b857a9..ec9a492b 100644 --- a/lib/services/sites.dart +++ b/lib/services/sites.dart @@ -1,255 +1,282 @@ part of '../dart_appwrite.dart'; - /// The Sites Service allows you view, create and manage your web applications. +/// The Sites Service allows you view, create and manage your web applications. class Sites extends Service { - Sites(super.client); + Sites(super.client); /// Get a list of all the project's sites. You can use the query params to /// filter your results. - Future list({List? queries, String? search, bool? total}) async { - final String apiPath = '/sites'; + Future list( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/sites'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.SiteList.fromMap(res.data); - - } + } /// Create a new site. - Future create({required String siteId, required String name, required enums.Framework framework, required enums.BuildRuntime buildRuntime, bool? enabled, bool? logging, int? timeout, String? installCommand, String? buildCommand, String? startCommand, String? outputDirectory, enums.Adapter? adapter, String? installationId, String? fallbackFile, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { - final String apiPath = '/sites'; + Future create( + {required String siteId, + required String name, + required enums.Framework framework, + required enums.BuildRuntime buildRuntime, + bool? enabled, + bool? logging, + int? timeout, + String? installCommand, + String? buildCommand, + String? startCommand, + String? outputDirectory, + enums.Adapter? adapter, + String? installationId, + String? fallbackFile, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? buildSpecification, + String? runtimeSpecification, + int? deploymentRetention}) async { + final String apiPath = '/sites'; final Map apiParams = { - 'siteId': siteId, -'name': name, -'framework': framework.value, -if (enabled != null) 'enabled': enabled, -if (logging != null) 'logging': logging, -if (timeout != null) 'timeout': timeout, -if (installCommand != null) 'installCommand': installCommand, -if (buildCommand != null) 'buildCommand': buildCommand, -if (startCommand != null) 'startCommand': startCommand, -if (outputDirectory != null) 'outputDirectory': outputDirectory, -'buildRuntime': buildRuntime.value, -if (adapter != null) 'adapter': adapter.value, -if (installationId != null) 'installationId': installationId, -if (fallbackFile != null) 'fallbackFile': fallbackFile, -if (providerRepositoryId != null) 'providerRepositoryId': providerRepositoryId, -if (providerBranch != null) 'providerBranch': providerBranch, -if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, -if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, -if (buildSpecification != null) 'buildSpecification': buildSpecification, -if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, -if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, - + 'name': name, + 'framework': framework.value, + if (enabled != null) 'enabled': enabled, + if (logging != null) 'logging': logging, + if (timeout != null) 'timeout': timeout, + if (installCommand != null) 'installCommand': installCommand, + if (buildCommand != null) 'buildCommand': buildCommand, + if (startCommand != null) 'startCommand': startCommand, + if (outputDirectory != null) 'outputDirectory': outputDirectory, + 'buildRuntime': buildRuntime.value, + if (adapter != null) 'adapter': adapter.value, + if (installationId != null) 'installationId': installationId, + if (fallbackFile != null) 'fallbackFile': fallbackFile, + if (providerRepositoryId != null) + 'providerRepositoryId': providerRepositoryId, + if (providerBranch != null) 'providerBranch': providerBranch, + if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, + if (providerRootDirectory != null) + 'providerRootDirectory': providerRootDirectory, + if (buildSpecification != null) 'buildSpecification': buildSpecification, + if (runtimeSpecification != null) + 'runtimeSpecification': runtimeSpecification, + if (deploymentRetention != null) + 'deploymentRetention': deploymentRetention, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - - } + } /// Get a list of all frameworks that are currently available on the server /// instance. - Future listFrameworks() async { - final String apiPath = '/sites/frameworks'; + Future listFrameworks() async { + final String apiPath = '/sites/frameworks'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.FrameworkList.fromMap(res.data); - - } + } /// List allowed site specifications for this instance. - Future listSpecifications() async { - final String apiPath = '/sites/specifications'; + Future listSpecifications() async { + final String apiPath = '/sites/specifications'; - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.SpecificationList.fromMap(res.data); - - } + } /// Get a site by its unique ID. - Future get({required String siteId}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + Future get({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - - } + } /// Update site by its unique ID. - Future update({required String siteId, required String name, required enums.Framework framework, bool? enabled, bool? logging, int? timeout, String? installCommand, String? buildCommand, String? startCommand, String? outputDirectory, enums.BuildRuntime? buildRuntime, enums.Adapter? adapter, String? fallbackFile, String? installationId, String? providerRepositoryId, String? providerBranch, bool? providerSilentMode, String? providerRootDirectory, String? buildSpecification, String? runtimeSpecification, int? deploymentRetention}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + Future update( + {required String siteId, + required String name, + required enums.Framework framework, + bool? enabled, + bool? logging, + int? timeout, + String? installCommand, + String? buildCommand, + String? startCommand, + String? outputDirectory, + enums.BuildRuntime? buildRuntime, + enums.Adapter? adapter, + String? fallbackFile, + String? installationId, + String? providerRepositoryId, + String? providerBranch, + bool? providerSilentMode, + String? providerRootDirectory, + String? buildSpecification, + String? runtimeSpecification, + int? deploymentRetention}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'name': name, -'framework': framework.value, -if (enabled != null) 'enabled': enabled, -if (logging != null) 'logging': logging, -if (timeout != null) 'timeout': timeout, -if (installCommand != null) 'installCommand': installCommand, -if (buildCommand != null) 'buildCommand': buildCommand, -if (startCommand != null) 'startCommand': startCommand, -if (outputDirectory != null) 'outputDirectory': outputDirectory, -if (buildRuntime != null) 'buildRuntime': buildRuntime.value, -if (adapter != null) 'adapter': adapter.value, -if (fallbackFile != null) 'fallbackFile': fallbackFile, -if (installationId != null) 'installationId': installationId, -if (providerRepositoryId != null) 'providerRepositoryId': providerRepositoryId, -if (providerBranch != null) 'providerBranch': providerBranch, -if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, -if (providerRootDirectory != null) 'providerRootDirectory': providerRootDirectory, -if (buildSpecification != null) 'buildSpecification': buildSpecification, -if (runtimeSpecification != null) 'runtimeSpecification': runtimeSpecification, -if (deploymentRetention != null) 'deploymentRetention': deploymentRetention, - + 'framework': framework.value, + if (enabled != null) 'enabled': enabled, + if (logging != null) 'logging': logging, + if (timeout != null) 'timeout': timeout, + if (installCommand != null) 'installCommand': installCommand, + if (buildCommand != null) 'buildCommand': buildCommand, + if (startCommand != null) 'startCommand': startCommand, + if (outputDirectory != null) 'outputDirectory': outputDirectory, + if (buildRuntime != null) 'buildRuntime': buildRuntime.value, + if (adapter != null) 'adapter': adapter.value, + if (fallbackFile != null) 'fallbackFile': fallbackFile, + if (installationId != null) 'installationId': installationId, + if (providerRepositoryId != null) + 'providerRepositoryId': providerRepositoryId, + if (providerBranch != null) 'providerBranch': providerBranch, + if (providerSilentMode != null) 'providerSilentMode': providerSilentMode, + if (providerRootDirectory != null) + 'providerRootDirectory': providerRootDirectory, + if (buildSpecification != null) 'buildSpecification': buildSpecification, + if (runtimeSpecification != null) + 'runtimeSpecification': runtimeSpecification, + if (deploymentRetention != null) + 'deploymentRetention': deploymentRetention, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - - } + } /// Delete a site by its unique ID. - Future delete({required String siteId}) async { - final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); + Future delete({required String siteId}) async { + final String apiPath = '/sites/{siteId}'.replaceAll('{siteId}', siteId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update the site active deployment. Use this endpoint to switch the code /// deployment that should be used when visitor opens your site. - Future updateSiteDeployment({required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployment'.replaceAll('{siteId}', siteId); + Future updateSiteDeployment( + {required String siteId, required String deploymentId}) async { + final String apiPath = + '/sites/{siteId}/deployment'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'deploymentId': deploymentId, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Site.fromMap(res.data); - - } + } /// Get a list of all the site's code deployments. You can use the query params /// to filter your results. - Future listDeployments({required String siteId, List? queries, String? search, bool? total}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future listDeployments( + {required String siteId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = + '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DeploymentList.fromMap(res.data); - - } + } /// Create a new site code deployment. Use this endpoint to upload a new /// version of your site code. To activate your newly uploaded code, you'll /// need to update the site's deployment to use your new deployment ID. - Future createDeployment({required String siteId, required InputFile code, String? installCommand, String? buildCommand, String? outputDirectory, bool? activate, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); + Future createDeployment( + {required String siteId, + required InputFile code, + String? installCommand, + String? buildCommand, + String? outputDirectory, + bool? activate, + Function(UploadProgress)? onProgress}) async { + final String apiPath = + '/sites/{siteId}/deployments'.replaceAll('{siteId}', siteId); final Map apiParams = { - if (installCommand != null) 'installCommand': installCommand, -if (buildCommand != null) 'buildCommand': buildCommand, -if (outputDirectory != null) 'outputDirectory': outputDirectory, -'code': code, -if (activate != null) 'activate': activate, - + if (buildCommand != null) 'buildCommand': buildCommand, + if (outputDirectory != null) 'outputDirectory': outputDirectory, + 'code': code, + if (activate != null) 'activate': activate, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -264,336 +291,337 @@ if (activate != null) 'activate': activate, ); return models.Deployment.fromMap(res.data); - - } + } /// Create a new build for an existing site deployment. This endpoint allows /// you to rebuild a deployment with the updated site configuration, including /// its commands and output directory if they have been modified. The build /// process will be queued and executed asynchronously. The original /// deployment's code will be preserved and used for the new build. - Future createDuplicateDeployment({required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/duplicate'.replaceAll('{siteId}', siteId); + Future createDuplicateDeployment( + {required String siteId, required String deploymentId}) async { + final String apiPath = + '/sites/{siteId}/deployments/duplicate'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'deploymentId': deploymentId, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Create a deployment based on a template. - /// + /// /// Use this endpoint with combination of /// [listTemplates](https://appwrite.io/docs/products/sites/templates) to find /// the template details. - Future createTemplateDeployment({required String siteId, required String repository, required String owner, required String rootDirectory, required enums.TemplateReferenceType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); + Future createTemplateDeployment( + {required String siteId, + required String repository, + required String owner, + required String rootDirectory, + required enums.TemplateReferenceType type, + required String reference, + bool? activate}) async { + final String apiPath = + '/sites/{siteId}/deployments/template'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'repository': repository, -'owner': owner, -'rootDirectory': rootDirectory, -'type': type.value, -'reference': reference, -if (activate != null) 'activate': activate, - + 'owner': owner, + 'rootDirectory': rootDirectory, + 'type': type.value, + 'reference': reference, + if (activate != null) 'activate': activate, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Create a deployment when a site is connected to VCS. - /// + /// /// This endpoint lets you create deployment from a branch, commit, or a tag. - Future createVcsDeployment({required String siteId, required enums.VCSReferenceType type, required String reference, bool? activate}) async { - final String apiPath = '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); + Future createVcsDeployment( + {required String siteId, + required enums.VCSReferenceType type, + required String reference, + bool? activate}) async { + final String apiPath = + '/sites/{siteId}/deployments/vcs'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'type': type.value, -'reference': reference, -if (activate != null) 'activate': activate, - + 'reference': reference, + if (activate != null) 'activate': activate, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Get a site deployment by its unique ID. - Future getDeployment({required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); + Future getDeployment( + {required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Delete a site deployment by its unique ID. - Future deleteDeployment({required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); + Future deleteDeployment( + {required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a site deployment content by its unique ID. The endpoint response /// return with a 'Content-Disposition: attachment' header that tells the /// browser to start downloading the file to user downloads directory. - Future getDeploymentDownload({required String siteId, required String deploymentId, enums.DeploymentDownloadType? type}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); + Future getDeploymentDownload( + {required String siteId, + required String deploymentId, + enums.DeploymentDownloadType? type}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/download' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); final Map params = { if (type != null) 'type': type.value, - - 'project': client.config['project'], 'key': client.config['key'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Cancel an ongoing site deployment build. If the build is already in /// progress, it will be stopped and marked as canceled. If the build hasn't /// started yet, it will be marked as canceled without executing. You cannot /// cancel builds that have already completed (status 'ready') or failed. The /// response includes the final build status and details. - Future updateDeploymentStatus({required String siteId, required String deploymentId}) async { - final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replaceAll('{siteId}', siteId).replaceAll('{deploymentId}', deploymentId); + Future updateDeploymentStatus( + {required String siteId, required String deploymentId}) async { + final String apiPath = '/sites/{siteId}/deployments/{deploymentId}/status' + .replaceAll('{siteId}', siteId) + .replaceAll('{deploymentId}', deploymentId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Deployment.fromMap(res.data); - - } + } /// Get a list of all site logs. You can use the query params to filter your /// results. - Future listLogs({required String siteId, List? queries, bool? total}) async { - final String apiPath = '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); + Future listLogs( + {required String siteId, List? queries, bool? total}) async { + final String apiPath = + '/sites/{siteId}/logs'.replaceAll('{siteId}', siteId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ExecutionList.fromMap(res.data); - - } + } /// Get a site request log by its unique ID. - Future getLog({required String siteId, required String logId}) async { - final String apiPath = '/sites/{siteId}/logs/{logId}'.replaceAll('{siteId}', siteId).replaceAll('{logId}', logId); + Future getLog( + {required String siteId, required String logId}) async { + final String apiPath = '/sites/{siteId}/logs/{logId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{logId}', logId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Execution.fromMap(res.data); - - } + } /// Delete a site log by its unique ID. - Future deleteLog({required String siteId, required String logId}) async { - final String apiPath = '/sites/{siteId}/logs/{logId}'.replaceAll('{siteId}', siteId).replaceAll('{logId}', logId); + Future deleteLog({required String siteId, required String logId}) async { + final String apiPath = '/sites/{siteId}/logs/{logId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{logId}', logId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all variables of a specific site. - Future listVariables({required String siteId, List? queries, bool? total}) async { - final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); + Future listVariables( + {required String siteId, List? queries, bool? total}) async { + final String apiPath = + '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.VariableList.fromMap(res.data); - - } + } /// Create a new site variable. These variables can be accessed during build /// and runtime (server-side rendering) as environment variables. - Future createVariable({required String siteId, required String variableId, required String key, required String value, bool? secret}) async { - final String apiPath = '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); + Future createVariable( + {required String siteId, + required String variableId, + required String key, + required String value, + bool? secret}) async { + final String apiPath = + '/sites/{siteId}/variables'.replaceAll('{siteId}', siteId); final Map apiParams = { - 'variableId': variableId, -'key': key, -'value': value, -if (secret != null) 'secret': secret, - + 'key': key, + 'value': value, + if (secret != null) 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Get a variable by its unique ID. - Future getVariable({required String siteId, required String variableId}) async { - final String apiPath = '/sites/{siteId}/variables/{variableId}'.replaceAll('{siteId}', siteId).replaceAll('{variableId}', variableId); + Future getVariable( + {required String siteId, required String variableId}) async { + final String apiPath = '/sites/{siteId}/variables/{variableId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{variableId}', variableId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Update variable by its unique ID. - Future updateVariable({required String siteId, required String variableId, String? key, String? value, bool? secret}) async { - final String apiPath = '/sites/{siteId}/variables/{variableId}'.replaceAll('{siteId}', siteId).replaceAll('{variableId}', variableId); + Future updateVariable( + {required String siteId, + required String variableId, + String? key, + String? value, + bool? secret}) async { + final String apiPath = '/sites/{siteId}/variables/{variableId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{variableId}', variableId); final Map apiParams = { - 'key': key, -'value': value, -'secret': secret, - + 'value': value, + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Variable.fromMap(res.data); - - } + } /// Delete a variable by its unique ID. - Future deleteVariable({required String siteId, required String variableId}) async { - final String apiPath = '/sites/{siteId}/variables/{variableId}'.replaceAll('{siteId}', siteId).replaceAll('{variableId}', variableId); + Future deleteVariable( + {required String siteId, required String variableId}) async { + final String apiPath = '/sites/{siteId}/variables/{variableId}' + .replaceAll('{siteId}', siteId) + .replaceAll('{variableId}', variableId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/storage.dart b/lib/services/storage.dart index b01e9afb..03fd7053 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -1,188 +1,201 @@ part of '../dart_appwrite.dart'; - /// The Storage service allows you to manage your project files. +/// The Storage service allows you to manage your project files. class Storage extends Service { - Storage(super.client); + Storage(super.client); /// Get a list of all the storage buckets. You can use the query params to /// filter your results. - Future listBuckets({List? queries, String? search, bool? total}) async { - final String apiPath = '/storage/buckets'; + Future listBuckets( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.BucketList.fromMap(res.data); - - } + } /// Create a new storage bucket. - Future createBucket({required String bucketId, required String name, List? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List? allowedFileExtensions, enums.Compression? compression, bool? encryption, bool? antivirus, bool? transformations}) async { - final String apiPath = '/storage/buckets'; + Future createBucket( + {required String bucketId, + required String name, + List? permissions, + bool? fileSecurity, + bool? enabled, + int? maximumFileSize, + List? allowedFileExtensions, + enums.Compression? compression, + bool? encryption, + bool? antivirus, + bool? transformations}) async { + final String apiPath = '/storage/buckets'; final Map apiParams = { - 'bucketId': bucketId, -'name': name, -'permissions': permissions, -if (fileSecurity != null) 'fileSecurity': fileSecurity, -if (enabled != null) 'enabled': enabled, -if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, -if (allowedFileExtensions != null) 'allowedFileExtensions': allowedFileExtensions, -if (compression != null) 'compression': compression.value, -if (encryption != null) 'encryption': encryption, -if (antivirus != null) 'antivirus': antivirus, -if (transformations != null) 'transformations': transformations, - + 'name': name, + 'permissions': permissions, + if (fileSecurity != null) 'fileSecurity': fileSecurity, + if (enabled != null) 'enabled': enabled, + if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, + if (allowedFileExtensions != null) + 'allowedFileExtensions': allowedFileExtensions, + if (compression != null) 'compression': compression.value, + if (encryption != null) 'encryption': encryption, + if (antivirus != null) 'antivirus': antivirus, + if (transformations != null) 'transformations': transformations, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Bucket.fromMap(res.data); - - } + } /// Get a storage bucket by its unique ID. This endpoint response returns a /// JSON object with the storage bucket metadata. - Future getBucket({required String bucketId}) async { - final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + Future getBucket({required String bucketId}) async { + final String apiPath = + '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Bucket.fromMap(res.data); - - } + } /// Update a storage bucket by its unique ID. - Future updateBucket({required String bucketId, required String name, List? permissions, bool? fileSecurity, bool? enabled, int? maximumFileSize, List? allowedFileExtensions, enums.Compression? compression, bool? encryption, bool? antivirus, bool? transformations}) async { - final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + Future updateBucket( + {required String bucketId, + required String name, + List? permissions, + bool? fileSecurity, + bool? enabled, + int? maximumFileSize, + List? allowedFileExtensions, + enums.Compression? compression, + bool? encryption, + bool? antivirus, + bool? transformations}) async { + final String apiPath = + '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); final Map apiParams = { - 'name': name, -'permissions': permissions, -if (fileSecurity != null) 'fileSecurity': fileSecurity, -if (enabled != null) 'enabled': enabled, -if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, -if (allowedFileExtensions != null) 'allowedFileExtensions': allowedFileExtensions, -if (compression != null) 'compression': compression.value, -if (encryption != null) 'encryption': encryption, -if (antivirus != null) 'antivirus': antivirus, -if (transformations != null) 'transformations': transformations, - + 'permissions': permissions, + if (fileSecurity != null) 'fileSecurity': fileSecurity, + if (enabled != null) 'enabled': enabled, + if (maximumFileSize != null) 'maximumFileSize': maximumFileSize, + if (allowedFileExtensions != null) + 'allowedFileExtensions': allowedFileExtensions, + if (compression != null) 'compression': compression.value, + if (encryption != null) 'encryption': encryption, + if (antivirus != null) 'antivirus': antivirus, + if (transformations != null) 'transformations': transformations, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Bucket.fromMap(res.data); - - } + } /// Delete a storage bucket by its unique ID. - Future deleteBucket({required String bucketId}) async { - final String apiPath = '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); + Future deleteBucket({required String bucketId}) async { + final String apiPath = + '/storage/buckets/{bucketId}'.replaceAll('{bucketId}', bucketId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all the user files. You can use the query params to filter /// your results. - Future listFiles({required String bucketId, List? queries, String? search, bool? total}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + Future listFiles( + {required String bucketId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = + '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.FileList.fromMap(res.data); - - } + } /// Create a new file. Before using this route, you should create a new bucket /// resource using either a [server /// integration](https://appwrite.io/docs/server/storage#storageCreateBucket) /// API or directly from your Appwrite console. - /// + /// /// Larger files should be uploaded using multiple requests with the /// [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) /// header to send a partial request with a maximum supported chunk of `5MB`. /// The `content-range` header values should always be in bytes. - /// + /// /// When the first request is sent, the server will return the **File** object, /// and the subsequent part request must include the file's **id** in /// `x-appwrite-id` header to allow the server to know that the partial upload /// is for the existing file and not for a new one. - /// + /// /// If you're creating a new file using one of the Appwrite SDKs, all the /// chunking logic will be managed by the SDK internally. - /// - Future createFile({required String bucketId, required String fileId, required InputFile file, List? permissions, Function(UploadProgress)? onProgress}) async { - final String apiPath = '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); + /// + Future createFile( + {required String bucketId, + required String fileId, + required InputFile file, + List? permissions, + Function(UploadProgress)? onProgress}) async { + final String apiPath = + '/storage/buckets/{bucketId}/files'.replaceAll('{bucketId}', bucketId); final Map apiParams = { - 'fileId': fileId, -'file': file, -if (permissions != null) 'permissions': permissions, - + 'file': file, + if (permissions != null) 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'multipart/form-data', - }; String idParamName = ''; @@ -198,137 +211,154 @@ if (permissions != null) 'permissions': permissions, ); return models.File.fromMap(res.data); - - } + } /// Get a file by its unique ID. This endpoint response returns a JSON object /// with the file metadata. - Future getFile({required String bucketId, required String fileId}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future getFile( + {required String bucketId, required String fileId}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.File.fromMap(res.data); - - } + } /// Update a file by its unique ID. Only users with write permissions have /// access to update this resource. - Future updateFile({required String bucketId, required String fileId, String? name, List? permissions}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future updateFile( + {required String bucketId, + required String fileId, + String? name, + List? permissions}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); final Map apiParams = { - if (name != null) 'name': name, -'permissions': permissions, - + 'permissions': permissions, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.File.fromMap(res.data); - - } + } /// Delete a file by its unique ID. Only users with write permissions have /// access to delete this resource. - Future deleteFile({required String bucketId, required String fileId}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future deleteFile({required String bucketId, required String fileId}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a file content by its unique ID. The endpoint response return with a /// 'Content-Disposition: attachment' header that tells the browser to start /// downloading the file to user downloads directory. - Future getFileDownload({required String bucketId, required String fileId, String? token}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future getFileDownload( + {required String bucketId, required String fileId, String? token}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); final Map params = { if (token != null) 'token': token, - - 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Get a file preview image. Currently, this method supports preview for image /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, /// and spreadsheets, will return the file icon image. You can also pass query /// string arguments for cutting and resizing your preview image. Preview is /// supported only for image files smaller than 10MB. - Future getFilePreview({required String bucketId, required String fileId, int? width, int? height, enums.ImageGravity? gravity, int? quality, int? borderWidth, String? borderColor, int? borderRadius, double? opacity, int? rotation, String? background, enums.ImageFormat? output, String? token}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future getFilePreview( + {required String bucketId, + required String fileId, + int? width, + int? height, + enums.ImageGravity? gravity, + int? quality, + int? borderWidth, + String? borderColor, + int? borderRadius, + double? opacity, + int? rotation, + String? background, + enums.ImageFormat? output, + String? token}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); final Map params = { if (width != null) 'width': width, -if (height != null) 'height': height, -if (gravity != null) 'gravity': gravity.value, -if (quality != null) 'quality': quality, -if (borderWidth != null) 'borderWidth': borderWidth, -if (borderColor != null) 'borderColor': borderColor, -if (borderRadius != null) 'borderRadius': borderRadius, -if (opacity != null) 'opacity': opacity, -if (rotation != null) 'rotation': rotation, -if (background != null) 'background': background, -if (output != null) 'output': output.value, -if (token != null) 'token': token, - - + if (height != null) 'height': height, + if (gravity != null) 'gravity': gravity.value, + if (quality != null) 'quality': quality, + if (borderWidth != null) 'borderWidth': borderWidth, + if (borderColor != null) 'borderColor': borderColor, + if (borderRadius != null) 'borderRadius': borderRadius, + if (opacity != null) 'opacity': opacity, + if (rotation != null) 'rotation': rotation, + if (background != null) 'background': background, + if (output != null) 'output': output.value, + if (token != null) 'token': token, 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } /// Get a file content by its unique ID. This endpoint is similar to the /// download method but returns with no 'Content-Disposition: attachment' /// header. - Future getFileView({required String bucketId, required String fileId, String? token}) async { - final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future getFileView( + {required String bucketId, required String fileId, String? token}) async { + final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); final Map params = { if (token != null) 'token': token, - - 'project': client.config['project'], 'session': client.config['session'], }; - final res = await client.call(HttpMethod.get, path: apiPath, params: params, responseType: ResponseType.bytes); + final res = await client.call(HttpMethod.get, + path: apiPath, params: params, responseType: ResponseType.bytes); return res.data; - } + } } diff --git a/lib/services/tables_db.dart b/lib/services/tables_db.dart index ec1d10c5..c8a06ef6 100644 --- a/lib/services/tables_db.dart +++ b/lib/services/tables_db.dart @@ -1,1293 +1,1531 @@ part of '../dart_appwrite.dart'; class TablesDB extends Service { - TablesDB(super.client); + TablesDB(super.client); /// Get a list of all databases from the current Appwrite project. You can use /// the search parameter to filter your results. - Future list({List? queries, String? search, bool? total}) async { - final String apiPath = '/tablesdb'; + Future list( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.DatabaseList.fromMap(res.data); - - } + } /// Create a new Database. - /// - Future create({required String databaseId, required String name, bool? enabled}) async { - final String apiPath = '/tablesdb'; + /// + Future create( + {required String databaseId, required String name, bool? enabled}) async { + final String apiPath = '/tablesdb'; final Map apiParams = { - 'databaseId': databaseId, -'name': name, -if (enabled != null) 'enabled': enabled, - + 'name': name, + if (enabled != null) 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - - } + } /// List transactions across all databases. - Future listTransactions({List? queries}) async { - final String apiPath = '/tablesdb/transactions'; + Future listTransactions( + {List? queries}) async { + final String apiPath = '/tablesdb/transactions'; final Map apiParams = { if (queries != null) 'queries': queries, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TransactionList.fromMap(res.data); - - } + } /// Create a new transaction. - Future createTransaction({int? ttl}) async { - final String apiPath = '/tablesdb/transactions'; + Future createTransaction({int? ttl}) async { + final String apiPath = '/tablesdb/transactions'; final Map apiParams = { - if (ttl != null) 'ttl': ttl, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Get a transaction by its unique ID. - Future getTransaction({required String transactionId}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); + Future getTransaction( + {required String transactionId}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}' + .replaceAll('{transactionId}', transactionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Update a transaction, to either commit or roll back its operations. - Future updateTransaction({required String transactionId, bool? commit, bool? rollback}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); + Future updateTransaction( + {required String transactionId, bool? commit, bool? rollback}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}' + .replaceAll('{transactionId}', transactionId); final Map apiParams = { - if (commit != null) 'commit': commit, -if (rollback != null) 'rollback': rollback, - + if (rollback != null) 'rollback': rollback, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Delete a transaction by its unique ID. - Future deleteTransaction({required String transactionId}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}'.replaceAll('{transactionId}', transactionId); + Future deleteTransaction({required String transactionId}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}' + .replaceAll('{transactionId}', transactionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Create multiple operations in a single transaction. - Future createOperations({required String transactionId, List? operations}) async { - final String apiPath = '/tablesdb/transactions/{transactionId}/operations'.replaceAll('{transactionId}', transactionId); + Future createOperations( + {required String transactionId, List? operations}) async { + final String apiPath = '/tablesdb/transactions/{transactionId}/operations' + .replaceAll('{transactionId}', transactionId); final Map apiParams = { - if (operations != null) 'operations': operations, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Transaction.fromMap(res.data); - - } + } /// Get a database by its unique ID. This endpoint response returns a JSON /// object with the database metadata. - Future get({required String databaseId}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + Future get({required String databaseId}) async { + final String apiPath = + '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - - } + } /// Update a database by its unique ID. - Future update({required String databaseId, String? name, bool? enabled}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + Future update( + {required String databaseId, String? name, bool? enabled}) async { + final String apiPath = + '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); final Map apiParams = { - if (name != null) 'name': name, -if (enabled != null) 'enabled': enabled, - + if (enabled != null) 'enabled': enabled, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Database.fromMap(res.data); - - } + } /// Delete a database by its unique ID. Only API keys with with databases.write /// scope can delete a database. - Future delete({required String databaseId}) async { - final String apiPath = '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); + Future delete({required String databaseId}) async { + final String apiPath = + '/tablesdb/{databaseId}'.replaceAll('{databaseId}', databaseId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all tables that belong to the provided databaseId. You can /// use the search parameter to filter your results. - Future listTables({required String databaseId, List? queries, String? search, bool? total}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future listTables( + {required String databaseId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TableList.fromMap(res.data); - - } + } /// Create a new Table. Before using this route, you should create a new /// database resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future createTable({required String databaseId, required String tableId, required String name, List? permissions, bool? rowSecurity, bool? enabled, List? columns, List? indexes}) async { - final String apiPath = '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); + Future createTable( + {required String databaseId, + required String tableId, + required String name, + List? permissions, + bool? rowSecurity, + bool? enabled, + List? columns, + List? indexes}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables'.replaceAll('{databaseId}', databaseId); final Map apiParams = { - 'tableId': tableId, -'name': name, -'permissions': permissions, -if (rowSecurity != null) 'rowSecurity': rowSecurity, -if (enabled != null) 'enabled': enabled, -if (columns != null) 'columns': columns, -if (indexes != null) 'indexes': indexes, - + 'name': name, + 'permissions': permissions, + if (rowSecurity != null) 'rowSecurity': rowSecurity, + if (enabled != null) 'enabled': enabled, + if (columns != null) 'columns': columns, + if (indexes != null) 'indexes': indexes, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Table.fromMap(res.data); - - } + } /// Get a table by its unique ID. This endpoint response returns a JSON object /// with the table metadata. - Future getTable({required String databaseId, required String tableId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future getTable( + {required String databaseId, required String tableId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Table.fromMap(res.data); - - } + } /// Update a table by its unique ID. - Future updateTable({required String databaseId, required String tableId, String? name, List? permissions, bool? rowSecurity, bool? enabled, bool? purge}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateTable( + {required String databaseId, + required String tableId, + String? name, + List? permissions, + bool? rowSecurity, + bool? enabled, + bool? purge}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - if (name != null) 'name': name, -'permissions': permissions, -if (rowSecurity != null) 'rowSecurity': rowSecurity, -if (enabled != null) 'enabled': enabled, -if (purge != null) 'purge': purge, - + 'permissions': permissions, + if (rowSecurity != null) 'rowSecurity': rowSecurity, + if (enabled != null) 'enabled': enabled, + if (purge != null) 'purge': purge, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Table.fromMap(res.data); - - } + } /// Delete a table by its unique ID. Only users with write permissions have /// access to delete this resource. - Future deleteTable({required String databaseId, required String tableId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future deleteTable( + {required String databaseId, required String tableId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// List columns in the table. - Future listColumns({required String databaseId, required String tableId, List? queries, bool? total}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future listColumns( + {required String databaseId, + required String tableId, + List? queries, + bool? total}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnList.fromMap(res.data); - - } + } /// Create a bigint column. Optionally, minimum and maximum values can be /// provided. - /// - Future createBigIntColumn({required String databaseId, required String tableId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createBigIntColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + int? min, + int? max, + int? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnBigint.fromMap(res.data); - - } + } /// Update a bigint column. Changing the `default` value will not update /// already existing rows. - /// - Future updateBigIntColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateBigIntColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required int? xdefault, + int? min, + int? max, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'newKey': newKey, - + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnBigint.fromMap(res.data); - - } + } /// Create a boolean column. - /// - Future createBooleanColumn({required String databaseId, required String tableId, required String key, required bool xrequired, bool? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createBooleanColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + bool? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnBoolean.fromMap(res.data); - - } + } /// Update a boolean column. Changing the `default` value will not update /// already existing rows. - Future updateBooleanColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required bool? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future updateBooleanColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required bool? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnBoolean.fromMap(res.data); - - } + } /// Create a date time column according to the ISO 8601 standard. - Future createDatetimeColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createDatetimeColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnDatetime.fromMap(res.data); - - } + } /// Update a date time column. Changing the `default` value will not update /// already existing rows. - Future updateDatetimeColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future updateDatetimeColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnDatetime.fromMap(res.data); - - } + } /// Create an email column. - /// - Future createEmailColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createEmailColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/email' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEmail.fromMap(res.data); - - } + } /// Update an email column. Changing the `default` value will not update /// already existing rows. - /// - Future updateEmailColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateEmailColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEmail.fromMap(res.data); - - } + } /// Create an enumeration column. The `elements` param acts as a white-list of /// accepted values for this column. - Future createEnumColumn({required String databaseId, required String tableId, required String key, required List elements, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createEnumColumn( + {required String databaseId, + required String tableId, + required String key, + required List elements, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/enum' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'elements': elements, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'elements': elements, + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEnum.fromMap(res.data); - - } + } /// Update an enum column. Changing the `default` value will not update already /// existing rows. - /// - Future updateEnumColumn({required String databaseId, required String tableId, required String key, required List elements, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateEnumColumn( + {required String databaseId, + required String tableId, + required String key, + required List elements, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'elements': elements, -'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'required': xrequired, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnEnum.fromMap(res.data); - - } + } /// Create a float column. Optionally, minimum and maximum values can be /// provided. - /// - Future createFloatColumn({required String databaseId, required String tableId, required String key, required bool xrequired, double? min, double? max, double? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createFloatColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + double? min, + double? max, + double? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/float' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnFloat.fromMap(res.data); - - } + } /// Update a float column. Changing the `default` value will not update already /// existing rows. - /// - Future updateFloatColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required double? xdefault, double? min, double? max, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateFloatColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required double? xdefault, + double? min, + double? max, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'newKey': newKey, - + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnFloat.fromMap(res.data); - - } + } /// Create an integer column. Optionally, minimum and maximum values can be /// provided. - /// - Future createIntegerColumn({required String databaseId, required String tableId, required String key, required bool xrequired, int? min, int? max, int? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createIntegerColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + int? min, + int? max, + int? xdefault, + bool? array}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/integer' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'min': min, + 'max': max, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnInteger.fromMap(res.data); - - } + } /// Update an integer column. Changing the `default` value will not update /// already existing rows. - /// - Future updateIntegerColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required int? xdefault, int? min, int? max, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateIntegerColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required int? xdefault, + int? min, + int? max, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'min': min, -'max': max, -'default': xdefault, -'newKey': newKey, - + 'min': min, + 'max': max, + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnInteger.fromMap(res.data); - - } + } /// Create IP address column. - /// - Future createIpColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createIpColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIp.fromMap(res.data); - - } + } /// Update an ip column. Changing the `default` value will not update already /// existing rows. - /// - Future updateIpColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateIpColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIp.fromMap(res.data); - - } + } /// Create a geometric line column. - Future createLineColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createLineColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + List? xdefault}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/line' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, - + 'required': xrequired, + 'default': xdefault, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLine.fromMap(res.data); - - } + } /// Update a line column. Changing the `default` value will not update already /// existing rows. - Future updateLineColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future updateLineColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + List? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLine.fromMap(res.data); - - } + } /// Create a longtext column. - /// - Future createLongtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createLongtextColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLongtext.fromMap(res.data); - - } + } /// Update a longtext column. Changing the `default` value will not update /// already existing rows. - /// - Future updateLongtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateLongtextColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnLongtext.fromMap(res.data); - - } + } /// Create a mediumtext column. - /// - Future createMediumtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createMediumtextColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnMediumtext.fromMap(res.data); - - } + } /// Update a mediumtext column. Changing the `default` value will not update /// already existing rows. - /// - Future updateMediumtextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateMediumtextColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnMediumtext.fromMap(res.data); - - } + } /// Create a geometric point column. - Future createPointColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createPointColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + List? xdefault}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/point' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, - + 'required': xrequired, + 'default': xdefault, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPoint.fromMap(res.data); - - } + } /// Update a point column. Changing the `default` value will not update already /// existing rows. - Future updatePointColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future updatePointColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + List? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPoint.fromMap(res.data); - - } + } /// Create a geometric polygon column. - Future createPolygonColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createPolygonColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + List? xdefault}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, - + 'required': xrequired, + 'default': xdefault, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPolygon.fromMap(res.data); - - } + } /// Update a polygon column. Changing the `default` value will not update /// already existing rows. - Future updatePolygonColumn({required String databaseId, required String tableId, required String key, required bool xrequired, List? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future updatePolygonColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + List? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnPolygon.fromMap(res.data); - - } + } /// Create relationship column. [Learn more about relationship /// columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - /// - Future createRelationshipColumn({required String databaseId, required String tableId, required String relatedTableId, required enums.RelationshipType type, bool? twoWay, String? key, String? twoWayKey, enums.RelationMutate? onDelete}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createRelationshipColumn( + {required String databaseId, + required String tableId, + required String relatedTableId, + required enums.RelationshipType type, + bool? twoWay, + String? key, + String? twoWayKey, + enums.RelationMutate? onDelete}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'relatedTableId': relatedTableId, -'type': type.value, -if (twoWay != null) 'twoWay': twoWay, -'key': key, -'twoWayKey': twoWayKey, -if (onDelete != null) 'onDelete': onDelete.value, - + 'type': type.value, + if (twoWay != null) 'twoWay': twoWay, + 'key': key, + 'twoWayKey': twoWayKey, + if (onDelete != null) 'onDelete': onDelete.value, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnRelationship.fromMap(res.data); - - } + } /// Create a string column. - /// - @Deprecated('This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead.') - Future createStringColumn({required String databaseId, required String tableId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + @Deprecated( + 'This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead.') + Future createStringColumn( + {required String databaseId, + required String tableId, + required String key, + required int size, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/string' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'size': size, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnString.fromMap(res.data); - - } + } /// Update a string column. Changing the `default` value will not update /// already existing rows. - /// - @Deprecated('This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead.') - Future updateStringColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead.') + Future updateStringColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + int? size, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'size': size, -'newKey': newKey, - + 'default': xdefault, + 'size': size, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnString.fromMap(res.data); - - } + } /// Create a text column. - /// - Future createTextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createTextColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/text' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnText.fromMap(res.data); - - } + } /// Update a text column. Changing the `default` value will not update already /// existing rows. - /// - Future updateTextColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateTextColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnText.fromMap(res.data); - - } + } /// Create a URL column. - /// - Future createUrlColumn({required String databaseId, required String tableId, required String key, required bool xrequired, String? xdefault, bool? array}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createUrlColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + String? xdefault, + bool? array}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, - + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnUrl.fromMap(res.data); - - } + } /// Update an url column. Changing the `default` value will not update already /// existing rows. - /// - Future updateUrlColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateUrlColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'newKey': newKey, - + 'default': xdefault, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnUrl.fromMap(res.data); - - } + } /// Create a varchar column. - /// - Future createVarcharColumn({required String databaseId, required String tableId, required String key, required int size, required bool xrequired, String? xdefault, bool? array, bool? encrypt}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future createVarcharColumn( + {required String databaseId, + required String tableId, + required String key, + required int size, + required bool xrequired, + String? xdefault, + bool? array, + bool? encrypt}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'size': size, -'required': xrequired, -'default': xdefault, -if (array != null) 'array': array, -if (encrypt != null) 'encrypt': encrypt, - + 'size': size, + 'required': xrequired, + 'default': xdefault, + if (array != null) 'array': array, + if (encrypt != null) 'encrypt': encrypt, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnVarchar.fromMap(res.data); - - } + } /// Update a varchar column. Changing the `default` value will not update /// already existing rows. - /// - Future updateVarcharColumn({required String databaseId, required String tableId, required String key, required bool xrequired, required String? xdefault, int? size, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateVarcharColumn( + {required String databaseId, + required String tableId, + required String key, + required bool xrequired, + required String? xdefault, + int? size, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'required': xrequired, -'default': xdefault, -'size': size, -'newKey': newKey, - + 'default': xdefault, + 'size': size, + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnVarchar.fromMap(res.data); - - } + } /// Get column by ID. - Future getColumn({required String databaseId, required String tableId, required String key}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future getColumn( + {required String databaseId, + required String tableId, + required String key}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return () { if (res.data is! Map) { - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); } final response = res.data as Map; @@ -1322,427 +1560,513 @@ if (encrypt != null) 'encrypt': encrypt, return models.ColumnString.fromMap(response); } - throw StateError('Unable to match response to any expected response model.'); + throw StateError( + 'Unable to match response to any expected response model.'); }(); - - } + } /// Deletes a column. - Future deleteColumn({required String databaseId, required String tableId, required String key}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future deleteColumn( + {required String databaseId, + required String tableId, + required String key}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update relationship column. [Learn more about relationship /// columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - /// - Future updateRelationshipColumn({required String databaseId, required String tableId, required String key, enums.RelationMutate? onDelete, String? newKey}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + /// + Future updateRelationshipColumn( + {required String databaseId, + required String tableId, + required String key, + enums.RelationMutate? onDelete, + String? newKey}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); final Map apiParams = { - 'onDelete': onDelete?.value, -'newKey': newKey, - + 'newKey': newKey, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnRelationship.fromMap(res.data); - - } + } /// List indexes on the table. - Future listIndexes({required String databaseId, required String tableId, List? queries, bool? total}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future listIndexes( + {required String databaseId, + required String tableId, + List? queries, + bool? total}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIndexList.fromMap(res.data); - - } + } /// Creates an index on the columns listed. Your index should include all the /// columns you will query in a single request. /// Type can be `key`, `fulltext`, or `unique`. - Future createIndex({required String databaseId, required String tableId, required String key, required enums.TablesDBIndexType type, required List columns, List? orders, List? lengths}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createIndex( + {required String databaseId, + required String tableId, + required String key, + required enums.TablesDBIndexType type, + required List columns, + List? orders, + List? lengths}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'key': key, -'type': type.value, -'columns': columns, -if (orders != null) 'orders': orders.map((e) => e.value).toList(), -if (lengths != null) 'lengths': lengths, - + 'type': type.value, + 'columns': columns, + if (orders != null) 'orders': orders.map((e) => e.value).toList(), + if (lengths != null) 'lengths': lengths, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIndex.fromMap(res.data); - - } + } /// Get index by ID. - Future getIndex({required String databaseId, required String tableId, required String key}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future getIndex( + {required String databaseId, + required String tableId, + required String key}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ColumnIndex.fromMap(res.data); - - } + } /// Delete an index. - Future deleteIndex({required String databaseId, required String tableId, required String key}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{key}', key); + Future deleteIndex( + {required String databaseId, + required String tableId, + required String key}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{key}', key); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Get a list of all the user's rows in a given table. You can use the query /// params to filter your results. - Future listRows({required String databaseId, required String tableId, List? queries, String? transactionId, bool? total, int? ttl}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future listRows( + {required String databaseId, + required String tableId, + List? queries, + String? transactionId, + bool? total, + int? ttl}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { if (queries != null) 'queries': queries, -if (transactionId != null) 'transactionId': transactionId, -if (total != null) 'total': total, -if (ttl != null) 'ttl': ttl, - - + if (transactionId != null) 'transactionId': transactionId, + if (total != null) 'total': total, + if (ttl != null) 'ttl': ttl, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - - } + } /// Create a new Row. Before using this route, you should create a new table /// resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future createRow({required String databaseId, required String tableId, required String rowId, required Map data, List? permissions, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createRow( + {required String databaseId, + required String tableId, + required String rowId, + required Map data, + List? permissions, + String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rowId': rowId, -'data': data, -'permissions': permissions, -'transactionId': transactionId, - + 'data': data, + 'permissions': permissions, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - - } + } /// Create new Rows. Before using this route, you should create a new table /// resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future createRows({required String databaseId, required String tableId, required List rows, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future createRows( + {required String databaseId, + required String tableId, + required List rows, + String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rows': rows, -'transactionId': transactionId, - + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - - } + } /// Create or update Rows. Before using this route, you should create a new /// table resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - /// - Future upsertRows({required String databaseId, required String tableId, required List rows, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + /// + Future upsertRows( + {required String databaseId, + required String tableId, + required List rows, + String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - 'rows': rows, -'transactionId': transactionId, - + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - - } + } /// Update all rows that match your queries, if no queries are submitted then /// all rows are updated. You can pass only specific fields to be updated. - Future updateRows({required String databaseId, required String tableId, Map? data, List? queries, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future updateRows( + {required String databaseId, + required String tableId, + Map? data, + List? queries, + String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - if (data != null) 'data': data, -if (queries != null) 'queries': queries, -'transactionId': transactionId, - + if (queries != null) 'queries': queries, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - - } + } /// Bulk delete rows using queries, if no queries are passed then all rows are /// deleted. - Future deleteRows({required String databaseId, required String tableId, List? queries, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId); + Future deleteRows( + {required String databaseId, + required String tableId, + List? queries, + String? transactionId}) async { + final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId); final Map apiParams = { - if (queries != null) 'queries': queries, -'transactionId': transactionId, - + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return models.RowList.fromMap(res.data); - - } + } /// Get a row by its unique ID. This endpoint response returns a JSON object /// with the row data. - Future getRow({required String databaseId, required String tableId, required String rowId, List? queries, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + Future getRow( + {required String databaseId, + required String tableId, + required String rowId, + List? queries, + String? transactionId}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { if (queries != null) 'queries': queries, -if (transactionId != null) 'transactionId': transactionId, - - + if (transactionId != null) 'transactionId': transactionId, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - - } + } /// Create or update a Row. Before using this route, you should create a new /// table resource using either a [server /// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) /// API or directly from your database console. - Future upsertRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + Future upsertRow( + {required String databaseId, + required String tableId, + required String rowId, + Map? data, + List? permissions, + String? transactionId}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - if (data != null) 'data': data, -'permissions': permissions, -'transactionId': transactionId, - + 'permissions': permissions, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - - } + } /// Update a row by its unique ID. Using the patch method you can pass only /// specific fields that will get updated. - Future updateRow({required String databaseId, required String tableId, required String rowId, Map? data, List? permissions, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + Future updateRow( + {required String databaseId, + required String tableId, + required String rowId, + Map? data, + List? permissions, + String? transactionId}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - if (data != null) 'data': data, -'permissions': permissions, -'transactionId': transactionId, - + 'permissions': permissions, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - - } + } /// Delete a row by its unique ID. - Future deleteRow({required String databaseId, required String tableId, required String rowId, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId); + Future deleteRow( + {required String databaseId, + required String tableId, + required String rowId, + String? transactionId}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId); final Map apiParams = { - 'transactionId': transactionId, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Decrement a specific column of a row by a given value. - Future decrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? min, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId).replaceAll('{column}', column); + Future decrementRowColumn( + {required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? min, + String? transactionId}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId) + .replaceAll('{column}', column); final Map apiParams = { - if (value != null) 'value': value, -'min': min, -'transactionId': transactionId, - + 'min': min, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - - } + } /// Increment a specific column of a row by a given value. - Future incrementRowColumn({required String databaseId, required String tableId, required String rowId, required String column, double? value, double? max, String? transactionId}) async { - final String apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replaceAll('{databaseId}', databaseId).replaceAll('{tableId}', tableId).replaceAll('{rowId}', rowId).replaceAll('{column}', column); + Future incrementRowColumn( + {required String databaseId, + required String tableId, + required String rowId, + required String column, + double? value, + double? max, + String? transactionId}) async { + final String apiPath = + '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' + .replaceAll('{databaseId}', databaseId) + .replaceAll('{tableId}', tableId) + .replaceAll('{rowId}', rowId) + .replaceAll('{column}', column); final Map apiParams = { - if (value != null) 'value': value, -'max': max, -'transactionId': transactionId, - + 'max': max, + 'transactionId': transactionId, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Row.fromMap(res.data); - - } + } } diff --git a/lib/services/teams.dart b/lib/services/teams.dart index 11062a30..32546bd3 100644 --- a/lib/services/teams.dart +++ b/lib/services/teams.dart @@ -1,142 +1,129 @@ part of '../dart_appwrite.dart'; - /// The Teams service allows you to group users of your project and to enable - /// them to share read and write access to your project resources +/// The Teams service allows you to group users of your project and to enable +/// them to share read and write access to your project resources class Teams extends Service { - Teams(super.client); + Teams(super.client); /// Get a list of all the teams in which the current user is a member. You can /// use the parameters to filter your results. - Future list({List? queries, String? search, bool? total}) async { - final String apiPath = '/teams'; + Future list( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/teams'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TeamList.fromMap(res.data); - - } + } /// Create a new team. The user who creates the team will automatically be /// assigned as the owner of the team. Only the users with the owner role can /// invite new members, add new owners and delete or update the team. - Future create({required String teamId, required String name, List? roles}) async { - final String apiPath = '/teams'; + Future create( + {required String teamId, + required String name, + List? roles}) async { + final String apiPath = '/teams'; final Map apiParams = { - 'teamId': teamId, -'name': name, -if (roles != null) 'roles': roles, - + 'name': name, + if (roles != null) 'roles': roles, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Team.fromMap(res.data); - - } + } /// Get a team by its ID. All team members have read access for this resource. - Future get({required String teamId}) async { - final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); + Future get({required String teamId}) async { + final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Team.fromMap(res.data); - - } + } /// Update the team's name by its unique ID. - Future updateName({required String teamId, required String name}) async { - final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); + Future updateName( + {required String teamId, required String name}) async { + final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); final Map apiParams = { - 'name': name, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Team.fromMap(res.data); - - } + } /// Delete a team using its ID. Only team members with the owner role can /// delete the team. - Future delete({required String teamId}) async { - final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); + Future delete({required String teamId}) async { + final String apiPath = '/teams/{teamId}'.replaceAll('{teamId}', teamId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Use this endpoint to list a team's members using the team's ID. All team /// members have read access to this endpoint. Hide sensitive attributes from /// the response by toggling membership privacy in the Console. - Future listMemberships({required String teamId, List? queries, String? search, bool? total}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + Future listMemberships( + {required String teamId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = + '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MembershipList.fromMap(res.data); - - } + } /// Invite a new member to join your team. Provide an ID for existing users, or /// invite unregistered users using an email or phone number. If initiated from @@ -144,182 +131,184 @@ if (total != null) 'total': total, /// team to the invited user, and an account will be created for them if one /// doesn't exist. If initiated from a Server SDK, the new member will be added /// automatically to the team. - /// + /// /// You only need to provide one of a user ID, email, or phone number. Appwrite /// will prioritize accepting the user ID > email > phone number if you provide /// more than one of these parameters. - /// + /// /// Use the `url` parameter to redirect the user from the invitation email to /// your app. After the user is redirected, use the [Update Team Membership /// Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) - /// endpoint to allow the user to accept the invitation to the team. - /// + /// endpoint to allow the user to accept the invitation to the team. + /// /// Please note that to avoid a [Redirect /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) /// Appwrite will accept the only redirect URLs under the domains you have /// added as a platform on the Appwrite Console. - /// - Future createMembership({required String teamId, required List roles, String? email, String? userId, String? phone, String? url, String? name}) async { - final String apiPath = '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); + /// + Future createMembership( + {required String teamId, + required List roles, + String? email, + String? userId, + String? phone, + String? url, + String? name}) async { + final String apiPath = + '/teams/{teamId}/memberships'.replaceAll('{teamId}', teamId); final Map apiParams = { - if (email != null) 'email': email, -if (userId != null) 'userId': userId, -if (phone != null) 'phone': phone, -'roles': roles, -if (url != null) 'url': url, -if (name != null) 'name': name, - + if (userId != null) 'userId': userId, + if (phone != null) 'phone': phone, + 'roles': roles, + if (url != null) 'url': url, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - - } + } /// Get a team member by the membership unique id. All team members have read /// access for this resource. Hide sensitive attributes from the response by /// toggling membership privacy in the Console. - Future getMembership({required String teamId, required String membershipId}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); + Future getMembership( + {required String teamId, required String membershipId}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}' + .replaceAll('{teamId}', teamId) + .replaceAll('{membershipId}', membershipId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - - } + } /// Modify the roles of a team member. Only team members with the owner role /// have access to this endpoint. Learn more about [roles and /// permissions](https://appwrite.io/docs/permissions). - /// - Future updateMembership({required String teamId, required String membershipId, required List roles}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); + /// + Future updateMembership( + {required String teamId, + required String membershipId, + required List roles}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}' + .replaceAll('{teamId}', teamId) + .replaceAll('{membershipId}', membershipId); final Map apiParams = { - 'roles': roles, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - - } + } /// This endpoint allows a user to leave a team or for a team owner to delete /// the membership of any other team member. You can also use this endpoint to /// delete a user membership even if it is not accepted. - Future deleteMembership({required String teamId, required String membershipId}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); + Future deleteMembership( + {required String teamId, required String membershipId}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}' + .replaceAll('{teamId}', teamId) + .replaceAll('{membershipId}', membershipId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Use this endpoint to allow a user to accept an invitation to join a team /// after being redirected back to your app from the invitation email received /// by the user. - /// + /// /// If the request is successful, a session for the user is automatically /// created. - /// - Future updateMembershipStatus({required String teamId, required String membershipId, required String userId, required String secret}) async { - final String apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replaceAll('{teamId}', teamId).replaceAll('{membershipId}', membershipId); + /// + Future updateMembershipStatus( + {required String teamId, + required String membershipId, + required String userId, + required String secret}) async { + final String apiPath = '/teams/{teamId}/memberships/{membershipId}/status' + .replaceAll('{teamId}', teamId) + .replaceAll('{membershipId}', membershipId); final Map apiParams = { - 'userId': userId, -'secret': secret, - + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Membership.fromMap(res.data); - - } + } /// Get the team's shared preferences by its unique ID. If a preference doesn't /// need to be shared by all team members, prefer storing them in [user /// preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). - Future getPrefs({required String teamId}) async { - final String apiPath = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); + Future getPrefs({required String teamId}) async { + final String apiPath = + '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - - } + } /// Update the team's preferences by its unique ID. The object you pass is /// stored as is and replaces any previous value. The maximum allowed prefs /// size is 64kB and throws an error if exceeded. - Future updatePrefs({required String teamId, required Map prefs}) async { - final String apiPath = '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); + Future updatePrefs( + {required String teamId, required Map prefs}) async { + final String apiPath = + '/teams/{teamId}/prefs'.replaceAll('{teamId}', teamId); final Map apiParams = { - 'prefs': prefs, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - - } + } } diff --git a/lib/services/tokens.dart b/lib/services/tokens.dart index 5bed5441..50115e87 100644 --- a/lib/services/tokens.dart +++ b/lib/services/tokens.dart @@ -1,110 +1,103 @@ part of '../dart_appwrite.dart'; class Tokens extends Service { - Tokens(super.client); + Tokens(super.client); /// List all the tokens created for a specific file or bucket. You can use the /// query params to filter your results. - Future list({required String bucketId, required String fileId, List? queries, bool? total}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future list( + {required String bucketId, + required String fileId, + List? queries, + bool? total}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceTokenList.fromMap(res.data); - - } + } /// Create a new token. A token is linked to a file. Token can be passed as a /// request URL search parameter. - Future createFileToken({required String bucketId, required String fileId, String? expire}) async { - final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replaceAll('{bucketId}', bucketId).replaceAll('{fileId}', fileId); + Future createFileToken( + {required String bucketId, + required String fileId, + String? expire}) async { + final String apiPath = '/tokens/buckets/{bucketId}/files/{fileId}' + .replaceAll('{bucketId}', bucketId) + .replaceAll('{fileId}', fileId); final Map apiParams = { - 'expire': expire, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceToken.fromMap(res.data); - - } + } /// Get a token by its unique ID. - Future get({required String tokenId}) async { - final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); + Future get({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceToken.fromMap(res.data); - - } + } /// Update a token by its unique ID. Use this endpoint to update a token's /// expiry date. - Future update({required String tokenId, String? expire}) async { - final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); + Future update( + {required String tokenId, String? expire}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); final Map apiParams = { - 'expire': expire, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.ResourceToken.fromMap(res.data); - - } + } /// Delete a token by its unique ID. - Future delete({required String tokenId}) async { - final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); + Future delete({required String tokenId}) async { + final String apiPath = '/tokens/{tokenId}'.replaceAll('{tokenId}', tokenId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } } diff --git a/lib/services/users.dart b/lib/services/users.dart index fc282b7c..6804e339 100644 --- a/lib/services/users.dart +++ b/lib/services/users.dart @@ -1,316 +1,320 @@ part of '../dart_appwrite.dart'; - /// The Users service allows you to manage your project users. +/// The Users service allows you to manage your project users. class Users extends Service { - Users(super.client); + Users(super.client); /// Get a list of all the project's users. You can use the query params to /// filter your results. - Future list({List? queries, String? search, bool? total}) async { - final String apiPath = '/users'; + Future list( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/users'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.UserList.fromMap(res.data); - - } + } /// Create a new user. - Future create({required String userId, String? email, String? phone, String? password, String? name}) async { - final String apiPath = '/users'; + Future create( + {required String userId, + String? email, + String? phone, + String? password, + String? name}) async { + final String apiPath = '/users'; final Map apiParams = { - 'userId': userId, -'email': email, -'phone': phone, -if (password != null) 'password': password, -if (name != null) 'name': name, - + 'email': email, + 'phone': phone, + if (password != null) 'password': password, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Create a new user. Password provided must be hashed with the /// [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createArgon2User({required String userId, required String email, required String password, String? name}) async { - final String apiPath = '/users/argon2'; + Future createArgon2User( + {required String userId, + required String email, + required String password, + String? name}) async { + final String apiPath = '/users/argon2'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Create a new user. Password provided must be hashed with the /// [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createBcryptUser({required String userId, required String email, required String password, String? name}) async { - final String apiPath = '/users/bcrypt'; + Future createBcryptUser( + {required String userId, + required String email, + required String password, + String? name}) async { + final String apiPath = '/users/bcrypt'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Get identities for all users. - Future listIdentities({List? queries, String? search, bool? total}) async { - final String apiPath = '/users/identities'; + Future listIdentities( + {List? queries, String? search, bool? total}) async { + final String apiPath = '/users/identities'; final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.IdentityList.fromMap(res.data); - - } + } /// Delete an identity by its unique ID. - Future deleteIdentity({required String identityId}) async { - final String apiPath = '/users/identities/{identityId}'.replaceAll('{identityId}', identityId); + Future deleteIdentity({required String identityId}) async { + final String apiPath = + '/users/identities/{identityId}'.replaceAll('{identityId}', identityId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Create a new user. Password provided must be hashed with the /// [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createMD5User({required String userId, required String email, required String password, String? name}) async { - final String apiPath = '/users/md5'; + Future createMD5User( + {required String userId, + required String email, + required String password, + String? name}) async { + final String apiPath = '/users/md5'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Create a new user. Password provided must be hashed with the /// [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createPHPassUser({required String userId, required String email, required String password, String? name}) async { - final String apiPath = '/users/phpass'; + Future createPHPassUser( + {required String userId, + required String email, + required String password, + String? name}) async { + final String apiPath = '/users/phpass'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Create a new user. Password provided must be hashed with the /// [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createScryptUser({required String userId, required String email, required String password, required String passwordSalt, required int passwordCpu, required int passwordMemory, required int passwordParallel, required int passwordLength, String? name}) async { - final String apiPath = '/users/scrypt'; + Future createScryptUser( + {required String userId, + required String email, + required String password, + required String passwordSalt, + required int passwordCpu, + required int passwordMemory, + required int passwordParallel, + required int passwordLength, + String? name}) async { + final String apiPath = '/users/scrypt'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -'passwordSalt': passwordSalt, -'passwordCpu': passwordCpu, -'passwordMemory': passwordMemory, -'passwordParallel': passwordParallel, -'passwordLength': passwordLength, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordCpu': passwordCpu, + 'passwordMemory': passwordMemory, + 'passwordParallel': passwordParallel, + 'passwordLength': passwordLength, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Create a new user. Password provided must be hashed with the [Scrypt /// Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) /// algorithm. Use the [POST /// /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to /// create users with a plain text password. - Future createScryptModifiedUser({required String userId, required String email, required String password, required String passwordSalt, required String passwordSaltSeparator, required String passwordSignerKey, String? name}) async { - final String apiPath = '/users/scrypt-modified'; + Future createScryptModifiedUser( + {required String userId, + required String email, + required String password, + required String passwordSalt, + required String passwordSaltSeparator, + required String passwordSignerKey, + String? name}) async { + final String apiPath = '/users/scrypt-modified'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -'passwordSalt': passwordSalt, -'passwordSaltSeparator': passwordSaltSeparator, -'passwordSignerKey': passwordSignerKey, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + 'passwordSalt': passwordSalt, + 'passwordSaltSeparator': passwordSaltSeparator, + 'passwordSignerKey': passwordSignerKey, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Create a new user. Password provided must be hashed with the /// [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use /// the [POST /users](https://appwrite.io/docs/server/users#usersCreate) /// endpoint to create users with a plain text password. - Future createSHAUser({required String userId, required String email, required String password, enums.PasswordHash? passwordVersion, String? name}) async { - final String apiPath = '/users/sha'; + Future createSHAUser( + {required String userId, + required String email, + required String password, + enums.PasswordHash? passwordVersion, + String? name}) async { + final String apiPath = '/users/sha'; final Map apiParams = { - 'userId': userId, -'email': email, -'password': password, -if (passwordVersion != null) 'passwordVersion': passwordVersion.value, -if (name != null) 'name': name, - + 'email': email, + 'password': password, + if (passwordVersion != null) 'passwordVersion': passwordVersion.value, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Get a user by its unique ID. - Future get({required String userId}) async { - final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); + Future get({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Delete a user by its unique ID, thereby releasing it's ID. Since ID is /// released and can be reused, all user-related resources like documents or @@ -318,812 +322,763 @@ if (name != null) 'name': name, /// ID reserved, use the /// [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) /// endpoint instead. - Future delete({required String userId}) async { - final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); + Future delete({required String userId}) async { + final String apiPath = '/users/{userId}'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update the user email by its unique ID. - Future updateEmail({required String userId, required String email}) async { - final String apiPath = '/users/{userId}/email'.replaceAll('{userId}', userId); + Future updateEmail( + {required String userId, required String email}) async { + final String apiPath = + '/users/{userId}/email'.replaceAll('{userId}', userId); final Map apiParams = { - 'email': email, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Enable or disable whether a user can impersonate other users. When /// impersonation headers are used, the request runs as the target user for API /// behavior, while internal audit logs still attribute the action to the /// original impersonator and store the impersonated target details only in /// internal audit payload data. - /// - Future updateImpersonator({required String userId, required bool impersonator}) async { - final String apiPath = '/users/{userId}/impersonator'.replaceAll('{userId}', userId); + /// + Future updateImpersonator( + {required String userId, required bool impersonator}) async { + final String apiPath = + '/users/{userId}/impersonator'.replaceAll('{userId}', userId); final Map apiParams = { - 'impersonator': impersonator, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Use this endpoint to create a JSON Web Token for user by its unique ID. You /// can use the resulting JWT to authenticate on behalf of the user. The JWT /// secret will become invalid if the session it uses gets deleted. - Future createJWT({required String userId, String? sessionId, int? duration}) async { - final String apiPath = '/users/{userId}/jwts'.replaceAll('{userId}', userId); + Future createJWT( + {required String userId, String? sessionId, int? duration}) async { + final String apiPath = + '/users/{userId}/jwts'.replaceAll('{userId}', userId); final Map apiParams = { - if (sessionId != null) 'sessionId': sessionId, -if (duration != null) 'duration': duration, - + if (duration != null) 'duration': duration, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Jwt.fromMap(res.data); + } - } - - /// Update the user labels by its unique ID. - /// + /// Update the user labels by its unique ID. + /// /// Labels can be used to grant access to resources. While teams are a way for /// user's to share access to a resource, labels can be defined by the /// developer to grant access without an invitation. See the [Permissions /// docs](https://appwrite.io/docs/permissions) for more info. - Future updateLabels({required String userId, required List labels}) async { - final String apiPath = '/users/{userId}/labels'.replaceAll('{userId}', userId); + Future updateLabels( + {required String userId, required List labels}) async { + final String apiPath = + '/users/{userId}/labels'.replaceAll('{userId}', userId); final Map apiParams = { - 'labels': labels, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Get the user activity logs list by its unique ID. - Future listLogs({required String userId, List? queries, bool? total}) async { - final String apiPath = '/users/{userId}/logs'.replaceAll('{userId}', userId); + Future listLogs( + {required String userId, List? queries, bool? total}) async { + final String apiPath = + '/users/{userId}/logs'.replaceAll('{userId}', userId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.LogList.fromMap(res.data); - - } + } /// Get the user membership list by its unique ID. - Future listMemberships({required String userId, List? queries, String? search, bool? total}) async { - final String apiPath = '/users/{userId}/memberships'.replaceAll('{userId}', userId); + Future listMemberships( + {required String userId, + List? queries, + String? search, + bool? total}) async { + final String apiPath = + '/users/{userId}/memberships'.replaceAll('{userId}', userId); final Map apiParams = { if (queries != null) 'queries': queries, -if (search != null) 'search': search, -if (total != null) 'total': total, - - + if (search != null) 'search': search, + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MembershipList.fromMap(res.data); - - } + } /// Enable or disable MFA on a user account. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.') - Future updateMfa({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.') + Future updateMfa( + {required String userId, required bool mfa}) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); final Map apiParams = { - 'mfa': mfa, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Enable or disable MFA on a user account. - Future updateMFA({required String userId, required bool mfa}) async { - final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); + Future updateMFA( + {required String userId, required bool mfa}) async { + final String apiPath = '/users/{userId}/mfa'.replaceAll('{userId}', userId); final Map apiParams = { - 'mfa': mfa, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Delete an authenticator app. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.') - Future deleteMfaAuthenticator({required String userId, required enums.AuthenticatorType type}) async { - final String apiPath = '/users/{userId}/mfa/authenticators/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.') + Future deleteMfaAuthenticator( + {required String userId, required enums.AuthenticatorType type}) async { + final String apiPath = '/users/{userId}/mfa/authenticators/{type}' + .replaceAll('{userId}', userId) + .replaceAll('{type}', type.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Delete an authenticator app. - Future deleteMFAAuthenticator({required String userId, required enums.AuthenticatorType type}) async { - final String apiPath = '/users/{userId}/mfa/authenticators/{type}'.replaceAll('{userId}', userId).replaceAll('{type}', type.value); + Future deleteMFAAuthenticator( + {required String userId, required enums.AuthenticatorType type}) async { + final String apiPath = '/users/{userId}/mfa/authenticators/{type}' + .replaceAll('{userId}', userId) + .replaceAll('{type}', type.value); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// List the factors available on the account to be used as a MFA challange. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead.') - Future listMfaFactors({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead.') + Future listMfaFactors({required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - - } + } /// List the factors available on the account to be used as a MFA challange. - Future listMFAFactors({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); + Future listMFAFactors({required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/factors'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaFactors.fromMap(res.data); - - } + } /// Get recovery codes that can be used as backup for MFA flow by User ID. /// Before getting codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead.') - Future getMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead.') + Future getMfaRecoveryCodes( + {required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Get recovery codes that can be used as backup for MFA flow by User ID. /// Before getting codes, they must be generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - Future getMFARecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + Future getMFARecoveryCodes( + {required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Regenerate recovery codes that can be used as backup for MFA flow by User /// ID. Before regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead.') - Future updateMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead.') + Future updateMfaRecoveryCodes( + {required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Regenerate recovery codes that can be used as backup for MFA flow by User /// ID. Before regenerating codes, they must be first generated using /// [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) /// method. - Future updateMFARecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + Future updateMFARecoveryCodes( + {required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Generate recovery codes used as backup for MFA flow for User ID. Recovery /// codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method by client SDK. - @Deprecated('This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead.') - Future createMfaRecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + @Deprecated( + 'This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead.') + Future createMfaRecoveryCodes( + {required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Generate recovery codes used as backup for MFA flow for User ID. Recovery /// codes can be used as a MFA verification type in /// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) /// method by client SDK. - Future createMFARecoveryCodes({required String userId}) async { - final String apiPath = '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); + Future createMFARecoveryCodes( + {required String userId}) async { + final String apiPath = + '/users/{userId}/mfa/recovery-codes'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.MfaRecoveryCodes.fromMap(res.data); - - } + } /// Update the user name by its unique ID. - Future updateName({required String userId, required String name}) async { - final String apiPath = '/users/{userId}/name'.replaceAll('{userId}', userId); + Future updateName( + {required String userId, required String name}) async { + final String apiPath = + '/users/{userId}/name'.replaceAll('{userId}', userId); final Map apiParams = { - 'name': name, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Update the user password by its unique ID. - Future updatePassword({required String userId, required String password}) async { - final String apiPath = '/users/{userId}/password'.replaceAll('{userId}', userId); + Future updatePassword( + {required String userId, required String password}) async { + final String apiPath = + '/users/{userId}/password'.replaceAll('{userId}', userId); final Map apiParams = { - 'password': password, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Update the user phone by its unique ID. - Future updatePhone({required String userId, required String number}) async { - final String apiPath = '/users/{userId}/phone'.replaceAll('{userId}', userId); + Future updatePhone( + {required String userId, required String number}) async { + final String apiPath = + '/users/{userId}/phone'.replaceAll('{userId}', userId); final Map apiParams = { - 'number': number, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Get the user preferences by its unique ID. - Future getPrefs({required String userId}) async { - final String apiPath = '/users/{userId}/prefs'.replaceAll('{userId}', userId); + Future getPrefs({required String userId}) async { + final String apiPath = + '/users/{userId}/prefs'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - - } + } /// Update the user preferences by its unique ID. The object you pass is stored /// as is, and replaces any previous value. The maximum allowed prefs size is /// 64kB and throws error if exceeded. - Future updatePrefs({required String userId, required Map prefs}) async { - final String apiPath = '/users/{userId}/prefs'.replaceAll('{userId}', userId); + Future updatePrefs( + {required String userId, required Map prefs}) async { + final String apiPath = + '/users/{userId}/prefs'.replaceAll('{userId}', userId); final Map apiParams = { - 'prefs': prefs, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Preferences.fromMap(res.data); - - } + } /// Get the user sessions list by its unique ID. - Future listSessions({required String userId, bool? total}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future listSessions( + {required String userId, bool? total}) async { + final String apiPath = + '/users/{userId}/sessions'.replaceAll('{userId}', userId); final Map apiParams = { if (total != null) 'total': total, - - }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.SessionList.fromMap(res.data); - - } + } /// Creates a session for a user. Returns an immediately usable session object. - /// + /// /// If you want to generate a token for a custom authentication flow, use the /// [POST /// /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) /// endpoint. - Future createSession({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future createSession({required String userId}) async { + final String apiPath = + '/users/{userId}/sessions'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Session.fromMap(res.data); - - } + } /// Delete all user's sessions by using the user's unique ID. - Future deleteSessions({required String userId}) async { - final String apiPath = '/users/{userId}/sessions'.replaceAll('{userId}', userId); + Future deleteSessions({required String userId}) async { + final String apiPath = + '/users/{userId}/sessions'.replaceAll('{userId}', userId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Delete a user sessions by its unique ID. - Future deleteSession({required String userId, required String sessionId}) async { - final String apiPath = '/users/{userId}/sessions/{sessionId}'.replaceAll('{userId}', userId).replaceAll('{sessionId}', sessionId); + Future deleteSession( + {required String userId, required String sessionId}) async { + final String apiPath = '/users/{userId}/sessions/{sessionId}' + .replaceAll('{userId}', userId) + .replaceAll('{sessionId}', sessionId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update the user status by its unique ID. Use this endpoint as an /// alternative to deleting a user if you want to keep user's ID reserved. - Future updateStatus({required String userId, required bool status}) async { - final String apiPath = '/users/{userId}/status'.replaceAll('{userId}', userId); + Future updateStatus( + {required String userId, required bool status}) async { + final String apiPath = + '/users/{userId}/status'.replaceAll('{userId}', userId); final Map apiParams = { - 'status': status, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// List the messaging targets that are associated with a user. - Future listTargets({required String userId, List? queries, bool? total}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + Future listTargets( + {required String userId, List? queries, bool? total}) async { + final String apiPath = + '/users/{userId}/targets'.replaceAll('{userId}', userId); final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.TargetList.fromMap(res.data); - - } + } /// Create a messaging target. - Future createTarget({required String userId, required String targetId, required enums.MessagingProviderType providerType, required String identifier, String? providerId, String? name}) async { - final String apiPath = '/users/{userId}/targets'.replaceAll('{userId}', userId); + Future createTarget( + {required String userId, + required String targetId, + required enums.MessagingProviderType providerType, + required String identifier, + String? providerId, + String? name}) async { + final String apiPath = + '/users/{userId}/targets'.replaceAll('{userId}', userId); final Map apiParams = { - 'targetId': targetId, -'providerType': providerType.value, -'identifier': identifier, -if (providerId != null) 'providerId': providerId, -if (name != null) 'name': name, - + 'providerType': providerType.value, + 'identifier': identifier, + if (providerId != null) 'providerId': providerId, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Target.fromMap(res.data); - - } + } /// Get a user's push notification target by ID. - Future getTarget({required String userId, required String targetId}) async { - final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); + Future getTarget( + {required String userId, required String targetId}) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Target.fromMap(res.data); - - } + } /// Update a messaging target. - Future updateTarget({required String userId, required String targetId, String? identifier, String? providerId, String? name}) async { - final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); + Future updateTarget( + {required String userId, + required String targetId, + String? identifier, + String? providerId, + String? name}) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); final Map apiParams = { - if (identifier != null) 'identifier': identifier, -if (providerId != null) 'providerId': providerId, -if (name != null) 'name': name, - + if (providerId != null) 'providerId': providerId, + if (name != null) 'name': name, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Target.fromMap(res.data); - - } + } /// Delete a messaging target. - Future deleteTarget({required String userId, required String targetId}) async { - final String apiPath = '/users/{userId}/targets/{targetId}'.replaceAll('{userId}', userId).replaceAll('{targetId}', targetId); + Future deleteTarget( + {required String userId, required String targetId}) async { + final String apiPath = '/users/{userId}/targets/{targetId}' + .replaceAll('{userId}', userId) + .replaceAll('{targetId}', targetId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Returns a token with a secret key for creating a session. Use the user ID /// and secret and submit a request to the [PUT /// /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) /// endpoint to complete the login process. - /// - Future createToken({required String userId, int? length, int? expire}) async { - final String apiPath = '/users/{userId}/tokens'.replaceAll('{userId}', userId); + /// + Future createToken( + {required String userId, int? length, int? expire}) async { + final String apiPath = + '/users/{userId}/tokens'.replaceAll('{userId}', userId); final Map apiParams = { - if (length != null) 'length': length, -if (expire != null) 'expire': expire, - + if (expire != null) 'expire': expire, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Token.fromMap(res.data); - - } + } /// Update the user email verification status by its unique ID. - Future updateEmailVerification({required String userId, required bool emailVerification}) async { - final String apiPath = '/users/{userId}/verification'.replaceAll('{userId}', userId); + Future updateEmailVerification( + {required String userId, required bool emailVerification}) async { + final String apiPath = + '/users/{userId}/verification'.replaceAll('{userId}', userId); final Map apiParams = { - 'emailVerification': emailVerification, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } /// Update the user phone verification status by its unique ID. - Future updatePhoneVerification({required String userId, required bool phoneVerification}) async { - final String apiPath = '/users/{userId}/verification/phone'.replaceAll('{userId}', userId); + Future updatePhoneVerification( + {required String userId, required bool phoneVerification}) async { + final String apiPath = + '/users/{userId}/verification/phone'.replaceAll('{userId}', userId); final Map apiParams = { - 'phoneVerification': phoneVerification, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.User.fromMap(res.data); - - } + } } diff --git a/lib/services/webhooks.dart b/lib/services/webhooks.dart index 3fd35e32..ae5dd16f 100644 --- a/lib/services/webhooks.dart +++ b/lib/services/webhooks.dart @@ -1,149 +1,149 @@ part of '../dart_appwrite.dart'; class Webhooks extends Service { - Webhooks(super.client); + Webhooks(super.client); /// Get a list of all webhooks belonging to the project. You can use the query /// params to filter your results. - Future list({List? queries, bool? total}) async { - final String apiPath = '/webhooks'; + Future list({List? queries, bool? total}) async { + final String apiPath = '/webhooks'; final Map apiParams = { if (queries != null) 'queries': queries, -if (total != null) 'total': total, - - + if (total != null) 'total': total, }; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.WebhookList.fromMap(res.data); - - } + } /// Create a new webhook. Use this endpoint to configure a URL that will /// receive events from Appwrite when specific events occur. - Future create({required String webhookId, required String url, required String name, required List events, bool? enabled, bool? tls, String? authUsername, String? authPassword, String? secret}) async { - final String apiPath = '/webhooks'; + Future create( + {required String webhookId, + required String url, + required String name, + required List events, + bool? enabled, + bool? tls, + String? authUsername, + String? authPassword, + String? secret}) async { + final String apiPath = '/webhooks'; final Map apiParams = { - 'webhookId': webhookId, -'url': url, -'name': name, -'events': events, -if (enabled != null) 'enabled': enabled, -if (tls != null) 'tls': tls, -if (authUsername != null) 'authUsername': authUsername, -if (authPassword != null) 'authPassword': authPassword, -'secret': secret, - + 'url': url, + 'name': name, + 'events': events, + if (enabled != null) 'enabled': enabled, + if (tls != null) 'tls': tls, + if (authUsername != null) 'authUsername': authUsername, + if (authPassword != null) 'authPassword': authPassword, + 'secret': secret, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.post, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.post, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - - } + } /// Get a webhook by its unique ID. This endpoint returns details about a - /// specific webhook configured for a project. - Future get({required String webhookId}) async { - final String apiPath = '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); + /// specific webhook configured for a project. + Future get({required String webhookId}) async { + final String apiPath = + '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); - final Map apiParams = { - - - }; + final Map apiParams = {}; - final Map apiHeaders = { - - }; + final Map apiHeaders = {}; - final res = await client.call(HttpMethod.get, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.get, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - - } + } /// Update a webhook by its unique ID. Use this endpoint to update the URL, /// events, or status of an existing webhook. - Future update({required String webhookId, required String name, required String url, required List events, bool? enabled, bool? tls, String? authUsername, String? authPassword}) async { - final String apiPath = '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); + Future update( + {required String webhookId, + required String name, + required String url, + required List events, + bool? enabled, + bool? tls, + String? authUsername, + String? authPassword}) async { + final String apiPath = + '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); final Map apiParams = { - 'name': name, -'url': url, -'events': events, -if (enabled != null) 'enabled': enabled, -if (tls != null) 'tls': tls, -if (authUsername != null) 'authUsername': authUsername, -if (authPassword != null) 'authPassword': authPassword, - + 'url': url, + 'events': events, + if (enabled != null) 'enabled': enabled, + if (tls != null) 'tls': tls, + if (authUsername != null) 'authUsername': authUsername, + if (authPassword != null) 'authPassword': authPassword, }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.put, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.put, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - - } + } /// Delete a webhook by its unique ID. Once deleted, the webhook will no longer - /// receive project events. - Future delete({required String webhookId}) async { - final String apiPath = '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); + /// receive project events. + Future delete({required String webhookId}) async { + final String apiPath = + '/webhooks/{webhookId}'.replaceAll('{webhookId}', webhookId); - final Map apiParams = { - - - }; + final Map apiParams = {}; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.delete, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.delete, + path: apiPath, params: apiParams, headers: apiHeaders); return res.data; - - } + } /// Update the webhook signing key. This endpoint can be used to regenerate the /// signing key used to sign and validate payload deliveries for a specific /// webhook. - Future updateSecret({required String webhookId, String? secret}) async { - final String apiPath = '/webhooks/{webhookId}/secret'.replaceAll('{webhookId}', webhookId); + Future updateSecret( + {required String webhookId, String? secret}) async { + final String apiPath = + '/webhooks/{webhookId}/secret'.replaceAll('{webhookId}', webhookId); final Map apiParams = { - 'secret': secret, - }; final Map apiHeaders = { 'content-type': 'application/json', - }; - final res = await client.call(HttpMethod.patch, path: apiPath, params: apiParams, headers: apiHeaders); + final res = await client.call(HttpMethod.patch, + path: apiPath, params: apiParams, headers: apiHeaders); return models.Webhook.fromMap(res.data); - - } + } } diff --git a/lib/src/client.dart b/lib/src/client.dart index e0e1207c..6f236f82 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -21,13 +21,14 @@ abstract class Client { factory Client({ String endPoint = 'https://cloud.appwrite.io/v1', bool selfSigned = false, - }) => createClient(endPoint: endPoint, selfSigned: selfSigned); + }) => + createClient(endPoint: endPoint, selfSigned: selfSigned); /// Handle OAuth2 session creation. Future webAuth(Uri url); /// Set self signed to [status]. - /// + /// /// If self signed is true, [Client] will ignore invalid certificates. /// This is helpful in environments where your Appwrite /// instance does not have a valid SSL certificate. @@ -109,7 +110,8 @@ abstract class Client { }); /// Send the API request. - Future call(HttpMethod method, { + Future call( + HttpMethod method, { String path = '', Map headers = const {}, Map params = const {}, diff --git a/lib/src/client_base.dart b/lib/src/client_base.dart index 488ee0ce..a8e2e1b2 100644 --- a/lib/src/client_base.dart +++ b/lib/src/client_base.dart @@ -2,36 +2,45 @@ import 'response.dart'; import 'client.dart'; import 'enums.dart'; -abstract class ClientBase implements Client { +abstract class ClientBase implements Client { /// Your project ID @override ClientBase setProject(value); + /// Your secret API key @override ClientBase setKey(value); + /// Your secret JSON Web Token @override ClientBase setJWT(value); @override ClientBase setLocale(value); + /// The user session to authenticate with @override ClientBase setSession(value); + /// The user agent string of the client that made the request @override ClientBase setForwardedUserAgent(value); + /// Your secret dev API key @override ClientBase setDevKey(value); + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. @override ClientBase setCookie(value); + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserId(value); + /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserEmail(value); + /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. @override ClientBase setImpersonateUserPhone(value); diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 95c71402..3e4e7300 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -16,7 +16,7 @@ ClientBase createClient({ ClientBrowser(endPoint: endPoint, selfSigned: selfSigned); class ClientBrowser extends ClientBase with ClientMixin { - static const int chunkSize = 5*1024*1024; + static const int chunkSize = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -34,7 +34,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '23.1.0', - 'X-Appwrite-Response-Format' : '1.9.4', + 'X-Appwrite-Response-Format': '1.9.4', }; config = {}; @@ -46,82 +46,92 @@ class ClientBrowser extends ClientBase with ClientMixin { @override String get endPoint => _endPoint; - /// Your project ID - @override - ClientBrowser setProject(value) { - config['project'] = value; - addHeader('X-Appwrite-Project', value); - return this; - } - /// Your secret API key - @override - ClientBrowser setKey(value) { - config['key'] = value; - addHeader('X-Appwrite-Key', value); - return this; - } - /// Your secret JSON Web Token - @override - ClientBrowser setJWT(value) { - config['jWT'] = value; - addHeader('X-Appwrite-JWT', value); - return this; - } - @override - ClientBrowser setLocale(value) { - config['locale'] = value; - addHeader('X-Appwrite-Locale', value); - return this; - } - /// The user session to authenticate with - @override - ClientBrowser setSession(value) { - config['session'] = value; - addHeader('X-Appwrite-Session', value); - return this; - } - /// The user agent string of the client that made the request - @override - ClientBrowser setForwardedUserAgent(value) { - config['forwardedUserAgent'] = value; - addHeader('X-Forwarded-User-Agent', value); - return this; - } - /// Your secret dev API key - @override - ClientBrowser setDevKey(value) { - config['devKey'] = value; - addHeader('X-Appwrite-Dev-Key', value); - return this; - } - /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. - @override - ClientBrowser setCookie(value) { - config['cookie'] = value; - addHeader('Cookie', value); - return this; - } - /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientBrowser setImpersonateUserId(value) { - config['impersonateUserId'] = value; - addHeader('X-Appwrite-Impersonate-User-Id', value); - return this; - } - /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientBrowser setImpersonateUserEmail(value) { - config['impersonateUserEmail'] = value; - addHeader('X-Appwrite-Impersonate-User-Email', value); - return this; - } - /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientBrowser setImpersonateUserPhone(value) { - config['impersonateUserPhone'] = value; - addHeader('X-Appwrite-Impersonate-User-Phone', value); - return this; - } + /// Your project ID + @override + ClientBrowser setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + + /// Your secret API key + @override + ClientBrowser setKey(value) { + config['key'] = value; + addHeader('X-Appwrite-Key', value); + return this; + } + + /// Your secret JSON Web Token + @override + ClientBrowser setJWT(value) { + config['jWT'] = value; + addHeader('X-Appwrite-JWT', value); + return this; + } + + @override + ClientBrowser setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + + /// The user session to authenticate with + @override + ClientBrowser setSession(value) { + config['session'] = value; + addHeader('X-Appwrite-Session', value); + return this; + } + + /// The user agent string of the client that made the request + @override + ClientBrowser setForwardedUserAgent(value) { + config['forwardedUserAgent'] = value; + addHeader('X-Forwarded-User-Agent', value); + return this; + } + + /// Your secret dev API key + @override + ClientBrowser setDevKey(value) { + config['devKey'] = value; + addHeader('X-Appwrite-Dev-Key', value); + return this; + } + + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientBrowser setCookie(value) { + config['cookie'] = value; + addHeader('Cookie', value); + return this; + } + + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientBrowser setImpersonateUserId(value) { + config['impersonateUserId'] = value; + addHeader('X-Appwrite-Impersonate-User-Id', value); + return this; + } + + /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientBrowser setImpersonateUserEmail(value) { + config['impersonateUserEmail'] = value; + addHeader('X-Appwrite-Impersonate-User-Email', value); + return this; + } + + /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientBrowser setImpersonateUserPhone(value) { + config['impersonateUserPhone'] = value; + addHeader('X-Appwrite-Impersonate-User-Phone', value); + return this; + } @override ClientBrowser setSelfSigned({bool status = true}) { @@ -175,7 +185,8 @@ class ClientBrowser extends ClientBase with ClientMixin { late Response res; if (size <= chunkSize) { - params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, filename: file.filename); + params[paramName] = http.MultipartFile.fromBytes(paramName, file.bytes!, + filename: file.filename); return call( HttpMethod.post, path: path, @@ -202,8 +213,8 @@ class ClientBrowser extends ClientBase with ClientMixin { List chunk = []; final end = min(offset + chunkSize, size); chunk = file.bytes!.getRange(offset, end).toList(); - params[paramName] = - http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); + params[paramName] = http.MultipartFile.fromBytes(paramName, chunk, + filename: file.filename); headers['content-range'] = 'bytes $offset-${min((offset + chunkSize - 1), size - 1)}/$size'; res = await call(HttpMethod.post, diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 35cc40d4..4f01b015 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -20,7 +20,7 @@ ClientBase createClient({ ); class ClientIO extends ClientBase with ClientMixin { - static const int chunkSize = 5*1024*1024; + static const int chunkSize = 5 * 1024 * 1024; String _endPoint; Map? _headers; @override @@ -43,8 +43,9 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-platform': 'server', 'x-sdk-language': 'dart', 'x-sdk-version': '23.1.0', - 'user-agent' : 'AppwriteDartSDK/23.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', - 'X-Appwrite-Response-Format' : '1.9.4', + 'user-agent': + 'AppwriteDartSDK/23.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})', + 'X-Appwrite-Response-Format': '1.9.4', }; config = {}; @@ -56,82 +57,92 @@ class ClientIO extends ClientBase with ClientMixin { @override String get endPoint => _endPoint; - /// Your project ID - @override - ClientIO setProject(value) { - config['project'] = value; - addHeader('X-Appwrite-Project', value); - return this; - } - /// Your secret API key - @override - ClientIO setKey(value) { - config['key'] = value; - addHeader('X-Appwrite-Key', value); - return this; - } - /// Your secret JSON Web Token - @override - ClientIO setJWT(value) { - config['jWT'] = value; - addHeader('X-Appwrite-JWT', value); - return this; - } - @override - ClientIO setLocale(value) { - config['locale'] = value; - addHeader('X-Appwrite-Locale', value); - return this; - } - /// The user session to authenticate with - @override - ClientIO setSession(value) { - config['session'] = value; - addHeader('X-Appwrite-Session', value); - return this; - } - /// The user agent string of the client that made the request - @override - ClientIO setForwardedUserAgent(value) { - config['forwardedUserAgent'] = value; - addHeader('X-Forwarded-User-Agent', value); - return this; - } - /// Your secret dev API key - @override - ClientIO setDevKey(value) { - config['devKey'] = value; - addHeader('X-Appwrite-Dev-Key', value); - return this; - } - /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. - @override - ClientIO setCookie(value) { - config['cookie'] = value; - addHeader('Cookie', value); - return this; - } - /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientIO setImpersonateUserId(value) { - config['impersonateUserId'] = value; - addHeader('X-Appwrite-Impersonate-User-Id', value); - return this; - } - /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientIO setImpersonateUserEmail(value) { - config['impersonateUserEmail'] = value; - addHeader('X-Appwrite-Impersonate-User-Email', value); - return this; - } - /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - @override - ClientIO setImpersonateUserPhone(value) { - config['impersonateUserPhone'] = value; - addHeader('X-Appwrite-Impersonate-User-Phone', value); - return this; - } + /// Your project ID + @override + ClientIO setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + + /// Your secret API key + @override + ClientIO setKey(value) { + config['key'] = value; + addHeader('X-Appwrite-Key', value); + return this; + } + + /// Your secret JSON Web Token + @override + ClientIO setJWT(value) { + config['jWT'] = value; + addHeader('X-Appwrite-JWT', value); + return this; + } + + @override + ClientIO setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + + /// The user session to authenticate with + @override + ClientIO setSession(value) { + config['session'] = value; + addHeader('X-Appwrite-Session', value); + return this; + } + + /// The user agent string of the client that made the request + @override + ClientIO setForwardedUserAgent(value) { + config['forwardedUserAgent'] = value; + addHeader('X-Forwarded-User-Agent', value); + return this; + } + + /// Your secret dev API key + @override + ClientIO setDevKey(value) { + config['devKey'] = value; + addHeader('X-Appwrite-Dev-Key', value); + return this; + } + + /// The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + @override + ClientIO setCookie(value) { + config['cookie'] = value; + addHeader('Cookie', value); + return this; + } + + /// Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientIO setImpersonateUserId(value) { + config['impersonateUserId'] = value; + addHeader('X-Appwrite-Impersonate-User-Id', value); + return this; + } + + /// Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientIO setImpersonateUserEmail(value) { + config['impersonateUserEmail'] = value; + addHeader('X-Appwrite-Impersonate-User-Email', value); + return this; + } + + /// Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + @override + ClientIO setImpersonateUserPhone(value) { + config['impersonateUserPhone'] = value; + addHeader('X-Appwrite-Impersonate-User-Phone', value); + return this; + } @override ClientIO setSelfSigned({bool status = true}) { @@ -234,8 +245,8 @@ class ClientIO extends ClientBase with ClientMixin { raf!.setPositionSync(offset); chunk = raf.readSync(chunkSize); } - params[paramName] = - http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename); + params[paramName] = http.MultipartFile.fromBytes(paramName, chunk, + filename: file.filename); headers['content-range'] = 'bytes $offset-${min((offset + chunkSize - 1), size - 1)}/$size'; res = await call(HttpMethod.post, diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index da94c3cb..dbb8106c 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -12,7 +12,6 @@ mixin ClientMixin { required Map headers, required Map params, }) { - http.BaseRequest request = http.Request(method.name(), uri); if (headers['content-type'] == 'multipart/form-data') { request = http.MultipartRequest(method.name(), uri); @@ -74,7 +73,8 @@ mixin ClientMixin { headers['User-Agent'] = Uri.encodeFull(headers['User-Agent']!); } if (headers['X-Forwarded-User-Agent'] != null) { - headers['X-Forwarded-User-Agent'] = Uri.encodeFull(headers['X-Forwarded-User-Agent']!); + headers['X-Forwarded-User-Agent'] = + Uri.encodeFull(headers['X-Forwarded-User-Agent']!); } request.headers.addAll(headers); @@ -121,18 +121,23 @@ mixin ClientMixin { return Response(data: data); } - Future toResponse(http.StreamedResponse streamedResponse) async { - if(streamedResponse.statusCode == 204) { - return http.Response('', - streamedResponse.statusCode, - headers: streamedResponse.headers.map((k,v) => k.toLowerCase()=='content-type' ? MapEntry(k, 'text/plain') : MapEntry(k,v)), - request: streamedResponse.request, - isRedirect: streamedResponse.isRedirect, - persistentConnection: streamedResponse.persistentConnection, - reasonPhrase: streamedResponse.reasonPhrase, - ); - } else { - return await http.Response.fromStream(streamedResponse); - } + Future toResponse( + http.StreamedResponse streamedResponse) async { + if (streamedResponse.statusCode == 204) { + return http.Response( + '', + streamedResponse.statusCode, + headers: streamedResponse.headers.map((k, v) => + k.toLowerCase() == 'content-type' + ? MapEntry(k, 'text/plain') + : MapEntry(k, v)), + request: streamedResponse.request, + isRedirect: streamedResponse.isRedirect, + persistentConnection: streamedResponse.persistentConnection, + reasonPhrase: streamedResponse.reasonPhrase, + ); + } else { + return await http.Response.fromStream(streamedResponse); + } } } diff --git a/lib/src/enums/adapter.dart b/lib/src/enums/adapter.dart index 3b92df32..b63e686c 100644 --- a/lib/src/enums/adapter.dart +++ b/lib/src/enums/adapter.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum Adapter { - xstatic(value: 'static'), - ssr(value: 'ssr'); + xstatic(value: 'static'), + ssr(value: 'ssr'); - const Adapter({ - required this.value - }); + const Adapter({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/attribute_status.dart b/lib/src/enums/attribute_status.dart index e81b83d3..baee982b 100644 --- a/lib/src/enums/attribute_status.dart +++ b/lib/src/enums/attribute_status.dart @@ -1,17 +1,15 @@ part of '../../enums.dart'; enum AttributeStatus { - available(value: 'available'), - processing(value: 'processing'), - deleting(value: 'deleting'), - stuck(value: 'stuck'), - failed(value: 'failed'); + available(value: 'available'), + processing(value: 'processing'), + deleting(value: 'deleting'), + stuck(value: 'stuck'), + failed(value: 'failed'); - const AttributeStatus({ - required this.value - }); + const AttributeStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/authentication_factor.dart b/lib/src/enums/authentication_factor.dart index 00d12830..1d5271eb 100644 --- a/lib/src/enums/authentication_factor.dart +++ b/lib/src/enums/authentication_factor.dart @@ -1,16 +1,14 @@ part of '../../enums.dart'; enum AuthenticationFactor { - email(value: 'email'), - phone(value: 'phone'), - totp(value: 'totp'), - recoverycode(value: 'recoverycode'); + email(value: 'email'), + phone(value: 'phone'), + totp(value: 'totp'), + recoverycode(value: 'recoverycode'); - const AuthenticationFactor({ - required this.value - }); + const AuthenticationFactor({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/authenticator_type.dart b/lib/src/enums/authenticator_type.dart index 10460393..c1fe8584 100644 --- a/lib/src/enums/authenticator_type.dart +++ b/lib/src/enums/authenticator_type.dart @@ -1,13 +1,11 @@ part of '../../enums.dart'; enum AuthenticatorType { - totp(value: 'totp'); + totp(value: 'totp'); - const AuthenticatorType({ - required this.value - }); + const AuthenticatorType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/backup_services.dart b/lib/src/enums/backup_services.dart index 34edd6b7..8bdf087a 100644 --- a/lib/src/enums/backup_services.dart +++ b/lib/src/enums/backup_services.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum BackupServices { - databases(value: 'databases'), - tablesdb(value: 'tablesdb'), - documentsdb(value: 'documentsdb'), - vectorsdb(value: 'vectorsdb'), - functions(value: 'functions'), - storage(value: 'storage'); + databases(value: 'databases'), + tablesdb(value: 'tablesdb'), + documentsdb(value: 'documentsdb'), + vectorsdb(value: 'vectorsdb'), + functions(value: 'functions'), + storage(value: 'storage'); - const BackupServices({ - required this.value - }); + const BackupServices({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/browser.dart b/lib/src/enums/browser.dart index 386fa11d..949f4c47 100644 --- a/lib/src/enums/browser.dart +++ b/lib/src/enums/browser.dart @@ -1,26 +1,24 @@ part of '../../enums.dart'; enum Browser { - avantBrowser(value: 'aa'), - androidWebViewBeta(value: 'an'), - googleChrome(value: 'ch'), - googleChromeIOS(value: 'ci'), - googleChromeMobile(value: 'cm'), - chromium(value: 'cr'), - mozillaFirefox(value: 'ff'), - safari(value: 'sf'), - mobileSafari(value: 'mf'), - microsoftEdge(value: 'ps'), - microsoftEdgeIOS(value: 'oi'), - operaMini(value: 'om'), - opera(value: 'op'), - operaNext(value: 'on'); + avantBrowser(value: 'aa'), + androidWebViewBeta(value: 'an'), + googleChrome(value: 'ch'), + googleChromeIOS(value: 'ci'), + googleChromeMobile(value: 'cm'), + chromium(value: 'cr'), + mozillaFirefox(value: 'ff'), + safari(value: 'sf'), + mobileSafari(value: 'mf'), + microsoftEdge(value: 'ps'), + microsoftEdgeIOS(value: 'oi'), + operaMini(value: 'om'), + opera(value: 'op'), + operaNext(value: 'on'); - const Browser({ - required this.value - }); + const Browser({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/browser_permission.dart b/lib/src/enums/browser_permission.dart index 765b3e0c..fb4983db 100644 --- a/lib/src/enums/browser_permission.dart +++ b/lib/src/enums/browser_permission.dart @@ -1,32 +1,30 @@ part of '../../enums.dart'; enum BrowserPermission { - geolocation(value: 'geolocation'), - camera(value: 'camera'), - microphone(value: 'microphone'), - notifications(value: 'notifications'), - midi(value: 'midi'), - push(value: 'push'), - clipboardRead(value: 'clipboard-read'), - clipboardWrite(value: 'clipboard-write'), - paymentHandler(value: 'payment-handler'), - usb(value: 'usb'), - bluetooth(value: 'bluetooth'), - accelerometer(value: 'accelerometer'), - gyroscope(value: 'gyroscope'), - magnetometer(value: 'magnetometer'), - ambientLightSensor(value: 'ambient-light-sensor'), - backgroundSync(value: 'background-sync'), - persistentStorage(value: 'persistent-storage'), - screenWakeLock(value: 'screen-wake-lock'), - webShare(value: 'web-share'), - xrSpatialTracking(value: 'xr-spatial-tracking'); + geolocation(value: 'geolocation'), + camera(value: 'camera'), + microphone(value: 'microphone'), + notifications(value: 'notifications'), + midi(value: 'midi'), + push(value: 'push'), + clipboardRead(value: 'clipboard-read'), + clipboardWrite(value: 'clipboard-write'), + paymentHandler(value: 'payment-handler'), + usb(value: 'usb'), + bluetooth(value: 'bluetooth'), + accelerometer(value: 'accelerometer'), + gyroscope(value: 'gyroscope'), + magnetometer(value: 'magnetometer'), + ambientLightSensor(value: 'ambient-light-sensor'), + backgroundSync(value: 'background-sync'), + persistentStorage(value: 'persistent-storage'), + screenWakeLock(value: 'screen-wake-lock'), + webShare(value: 'web-share'), + xrSpatialTracking(value: 'xr-spatial-tracking'); - const BrowserPermission({ - required this.value - }); + const BrowserPermission({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/build_runtime.dart b/lib/src/enums/build_runtime.dart index 70967c22..abb0e080 100644 --- a/lib/src/enums/build_runtime.dart +++ b/lib/src/enums/build_runtime.dart @@ -1,101 +1,99 @@ part of '../../enums.dart'; enum BuildRuntime { - node145(value: 'node-14.5'), - node160(value: 'node-16.0'), - node180(value: 'node-18.0'), - node190(value: 'node-19.0'), - node200(value: 'node-20.0'), - node210(value: 'node-21.0'), - node22(value: 'node-22'), - node23(value: 'node-23'), - node24(value: 'node-24'), - node25(value: 'node-25'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - php84(value: 'php-8.4'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - ruby34(value: 'ruby-3.4'), - ruby40(value: 'ruby-4.0'), - python38(value: 'python-3.8'), - python39(value: 'python-3.9'), - python310(value: 'python-3.10'), - python311(value: 'python-3.11'), - python312(value: 'python-3.12'), - python313(value: 'python-3.13'), - python314(value: 'python-3.14'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - pythonMl313(value: 'python-ml-3.13'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - deno25(value: 'deno-2.5'), - deno26(value: 'deno-2.6'), - dart215(value: 'dart-2.15'), - dart216(value: 'dart-2.16'), - dart217(value: 'dart-2.17'), - dart218(value: 'dart-2.18'), - dart219(value: 'dart-2.19'), - dart30(value: 'dart-3.0'), - dart31(value: 'dart-3.1'), - dart33(value: 'dart-3.3'), - dart35(value: 'dart-3.5'), - dart38(value: 'dart-3.8'), - dart39(value: 'dart-3.9'), - dart310(value: 'dart-3.10'), - dart311(value: 'dart-3.11'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - dotnet10(value: 'dotnet-10'), - java80(value: 'java-8.0'), - java110(value: 'java-11.0'), - java170(value: 'java-17.0'), - java180(value: 'java-18.0'), - java210(value: 'java-21.0'), - java22(value: 'java-22'), - java25(value: 'java-25'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - swift62(value: 'swift-6.2'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - kotlin23(value: 'kotlin-2.3'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - bun12(value: 'bun-1.2'), - bun13(value: 'bun-1.3'), - go123(value: 'go-1.23'), - go124(value: 'go-1.24'), - go125(value: 'go-1.25'), - go126(value: 'go-1.26'), - rust183(value: 'rust-1.83'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'), - flutter335(value: 'flutter-3.35'), - flutter338(value: 'flutter-3.38'), - flutter341(value: 'flutter-3.41'); + node145(value: 'node-14.5'), + node160(value: 'node-16.0'), + node180(value: 'node-18.0'), + node190(value: 'node-19.0'), + node200(value: 'node-20.0'), + node210(value: 'node-21.0'), + node22(value: 'node-22'), + node23(value: 'node-23'), + node24(value: 'node-24'), + node25(value: 'node-25'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + php84(value: 'php-8.4'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + ruby34(value: 'ruby-3.4'), + ruby40(value: 'ruby-4.0'), + python38(value: 'python-3.8'), + python39(value: 'python-3.9'), + python310(value: 'python-3.10'), + python311(value: 'python-3.11'), + python312(value: 'python-3.12'), + python313(value: 'python-3.13'), + python314(value: 'python-3.14'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + pythonMl313(value: 'python-ml-3.13'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + deno25(value: 'deno-2.5'), + deno26(value: 'deno-2.6'), + dart215(value: 'dart-2.15'), + dart216(value: 'dart-2.16'), + dart217(value: 'dart-2.17'), + dart218(value: 'dart-2.18'), + dart219(value: 'dart-2.19'), + dart30(value: 'dart-3.0'), + dart31(value: 'dart-3.1'), + dart33(value: 'dart-3.3'), + dart35(value: 'dart-3.5'), + dart38(value: 'dart-3.8'), + dart39(value: 'dart-3.9'), + dart310(value: 'dart-3.10'), + dart311(value: 'dart-3.11'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + dotnet10(value: 'dotnet-10'), + java80(value: 'java-8.0'), + java110(value: 'java-11.0'), + java170(value: 'java-17.0'), + java180(value: 'java-18.0'), + java210(value: 'java-21.0'), + java22(value: 'java-22'), + java25(value: 'java-25'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + swift62(value: 'swift-6.2'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + kotlin23(value: 'kotlin-2.3'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + bun12(value: 'bun-1.2'), + bun13(value: 'bun-1.3'), + go123(value: 'go-1.23'), + go124(value: 'go-1.24'), + go125(value: 'go-1.25'), + go126(value: 'go-1.26'), + rust183(value: 'rust-1.83'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'), + flutter335(value: 'flutter-3.35'), + flutter338(value: 'flutter-3.38'), + flutter341(value: 'flutter-3.41'); - const BuildRuntime({ - required this.value - }); + const BuildRuntime({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/column_status.dart b/lib/src/enums/column_status.dart index 22267346..2800e7f8 100644 --- a/lib/src/enums/column_status.dart +++ b/lib/src/enums/column_status.dart @@ -1,17 +1,15 @@ part of '../../enums.dart'; enum ColumnStatus { - available(value: 'available'), - processing(value: 'processing'), - deleting(value: 'deleting'), - stuck(value: 'stuck'), - failed(value: 'failed'); + available(value: 'available'), + processing(value: 'processing'), + deleting(value: 'deleting'), + stuck(value: 'stuck'), + failed(value: 'failed'); - const ColumnStatus({ - required this.value - }); + const ColumnStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/compression.dart b/lib/src/enums/compression.dart index 209acfb8..768930d9 100644 --- a/lib/src/enums/compression.dart +++ b/lib/src/enums/compression.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum Compression { - none(value: 'none'), - gzip(value: 'gzip'), - zstd(value: 'zstd'); + none(value: 'none'), + gzip(value: 'gzip'), + zstd(value: 'zstd'); - const Compression({ - required this.value - }); + const Compression({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/credit_card.dart b/lib/src/enums/credit_card.dart index 4d6bce3a..28c2a1b3 100644 --- a/lib/src/enums/credit_card.dart +++ b/lib/src/enums/credit_card.dart @@ -1,29 +1,27 @@ part of '../../enums.dart'; enum CreditCard { - americanExpress(value: 'amex'), - argencard(value: 'argencard'), - cabal(value: 'cabal'), - cencosud(value: 'cencosud'), - dinersClub(value: 'diners'), - discover(value: 'discover'), - elo(value: 'elo'), - hipercard(value: 'hipercard'), - jCB(value: 'jcb'), - mastercard(value: 'mastercard'), - naranja(value: 'naranja'), - tarjetaShopping(value: 'targeta-shopping'), - unionPay(value: 'unionpay'), - visa(value: 'visa'), - mIR(value: 'mir'), - maestro(value: 'maestro'), - rupay(value: 'rupay'); + americanExpress(value: 'amex'), + argencard(value: 'argencard'), + cabal(value: 'cabal'), + cencosud(value: 'cencosud'), + dinersClub(value: 'diners'), + discover(value: 'discover'), + elo(value: 'elo'), + hipercard(value: 'hipercard'), + jCB(value: 'jcb'), + mastercard(value: 'mastercard'), + naranja(value: 'naranja'), + tarjetaShopping(value: 'targeta-shopping'), + unionPay(value: 'unionpay'), + visa(value: 'visa'), + mIR(value: 'mir'), + maestro(value: 'maestro'), + rupay(value: 'rupay'); - const CreditCard({ - required this.value - }); + const CreditCard({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/database_type.dart b/lib/src/enums/database_type.dart index 28189091..c6887ffc 100644 --- a/lib/src/enums/database_type.dart +++ b/lib/src/enums/database_type.dart @@ -1,16 +1,14 @@ part of '../../enums.dart'; enum DatabaseType { - legacy(value: 'legacy'), - tablesdb(value: 'tablesdb'), - documentsdb(value: 'documentsdb'), - vectorsdb(value: 'vectorsdb'); + legacy(value: 'legacy'), + tablesdb(value: 'tablesdb'), + documentsdb(value: 'documentsdb'), + vectorsdb(value: 'vectorsdb'); - const DatabaseType({ - required this.value - }); + const DatabaseType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/databases_index_type.dart b/lib/src/enums/databases_index_type.dart index c7212764..1ae29cf6 100644 --- a/lib/src/enums/databases_index_type.dart +++ b/lib/src/enums/databases_index_type.dart @@ -1,16 +1,14 @@ part of '../../enums.dart'; enum DatabasesIndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'), - spatial(value: 'spatial'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'), + spatial(value: 'spatial'); - const DatabasesIndexType({ - required this.value - }); + const DatabasesIndexType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/deployment_download_type.dart b/lib/src/enums/deployment_download_type.dart index 782b30c7..1788f892 100644 --- a/lib/src/enums/deployment_download_type.dart +++ b/lib/src/enums/deployment_download_type.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum DeploymentDownloadType { - source(value: 'source'), - output(value: 'output'); + source(value: 'source'), + output(value: 'output'); - const DeploymentDownloadType({ - required this.value - }); + const DeploymentDownloadType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/deployment_status.dart b/lib/src/enums/deployment_status.dart index c6087eb2..ed0aa57f 100644 --- a/lib/src/enums/deployment_status.dart +++ b/lib/src/enums/deployment_status.dart @@ -1,18 +1,16 @@ part of '../../enums.dart'; enum DeploymentStatus { - waiting(value: 'waiting'), - processing(value: 'processing'), - building(value: 'building'), - ready(value: 'ready'), - canceled(value: 'canceled'), - failed(value: 'failed'); + waiting(value: 'waiting'), + processing(value: 'processing'), + building(value: 'building'), + ready(value: 'ready'), + canceled(value: 'canceled'), + failed(value: 'failed'); - const DeploymentStatus({ - required this.value - }); + const DeploymentStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/email_template_locale.dart b/lib/src/enums/email_template_locale.dart index 26766a5b..d79a7975 100644 --- a/lib/src/enums/email_template_locale.dart +++ b/lib/src/enums/email_template_locale.dart @@ -1,143 +1,141 @@ part of '../../enums.dart'; enum EmailTemplateLocale { - af(value: 'af'), - arAe(value: 'ar-ae'), - arBh(value: 'ar-bh'), - arDz(value: 'ar-dz'), - arEg(value: 'ar-eg'), - arIq(value: 'ar-iq'), - arJo(value: 'ar-jo'), - arKw(value: 'ar-kw'), - arLb(value: 'ar-lb'), - arLy(value: 'ar-ly'), - arMa(value: 'ar-ma'), - arOm(value: 'ar-om'), - arQa(value: 'ar-qa'), - arSa(value: 'ar-sa'), - arSy(value: 'ar-sy'), - arTn(value: 'ar-tn'), - arYe(value: 'ar-ye'), - xas(value: 'as'), - az(value: 'az'), - be(value: 'be'), - bg(value: 'bg'), - bh(value: 'bh'), - bn(value: 'bn'), - bs(value: 'bs'), - ca(value: 'ca'), - cs(value: 'cs'), - cy(value: 'cy'), - da(value: 'da'), - de(value: 'de'), - deAt(value: 'de-at'), - deCh(value: 'de-ch'), - deLi(value: 'de-li'), - deLu(value: 'de-lu'), - el(value: 'el'), - en(value: 'en'), - enAu(value: 'en-au'), - enBz(value: 'en-bz'), - enCa(value: 'en-ca'), - enGb(value: 'en-gb'), - enIe(value: 'en-ie'), - enJm(value: 'en-jm'), - enNz(value: 'en-nz'), - enTt(value: 'en-tt'), - enUs(value: 'en-us'), - enZa(value: 'en-za'), - eo(value: 'eo'), - es(value: 'es'), - esAr(value: 'es-ar'), - esBo(value: 'es-bo'), - esCl(value: 'es-cl'), - esCo(value: 'es-co'), - esCr(value: 'es-cr'), - esDo(value: 'es-do'), - esEc(value: 'es-ec'), - esGt(value: 'es-gt'), - esHn(value: 'es-hn'), - esMx(value: 'es-mx'), - esNi(value: 'es-ni'), - esPa(value: 'es-pa'), - esPe(value: 'es-pe'), - esPr(value: 'es-pr'), - esPy(value: 'es-py'), - esSv(value: 'es-sv'), - esUy(value: 'es-uy'), - esVe(value: 'es-ve'), - et(value: 'et'), - eu(value: 'eu'), - fa(value: 'fa'), - fi(value: 'fi'), - fo(value: 'fo'), - fr(value: 'fr'), - frBe(value: 'fr-be'), - frCa(value: 'fr-ca'), - frCh(value: 'fr-ch'), - frLu(value: 'fr-lu'), - ga(value: 'ga'), - gd(value: 'gd'), - he(value: 'he'), - hi(value: 'hi'), - hr(value: 'hr'), - hu(value: 'hu'), - id(value: 'id'), - xis(value: 'is'), - it(value: 'it'), - itCh(value: 'it-ch'), - ja(value: 'ja'), - ji(value: 'ji'), - ko(value: 'ko'), - ku(value: 'ku'), - lt(value: 'lt'), - lv(value: 'lv'), - mk(value: 'mk'), - ml(value: 'ml'), - ms(value: 'ms'), - mt(value: 'mt'), - nb(value: 'nb'), - ne(value: 'ne'), - nl(value: 'nl'), - nlBe(value: 'nl-be'), - nn(value: 'nn'), - no(value: 'no'), - pa(value: 'pa'), - pl(value: 'pl'), - pt(value: 'pt'), - ptBr(value: 'pt-br'), - rm(value: 'rm'), - ro(value: 'ro'), - roMd(value: 'ro-md'), - ru(value: 'ru'), - ruMd(value: 'ru-md'), - sb(value: 'sb'), - sk(value: 'sk'), - sl(value: 'sl'), - sq(value: 'sq'), - sr(value: 'sr'), - sv(value: 'sv'), - svFi(value: 'sv-fi'), - th(value: 'th'), - tn(value: 'tn'), - tr(value: 'tr'), - ts(value: 'ts'), - ua(value: 'ua'), - ur(value: 'ur'), - ve(value: 've'), - vi(value: 'vi'), - xh(value: 'xh'), - zhCn(value: 'zh-cn'), - zhHk(value: 'zh-hk'), - zhSg(value: 'zh-sg'), - zhTw(value: 'zh-tw'), - zu(value: 'zu'); + af(value: 'af'), + arAe(value: 'ar-ae'), + arBh(value: 'ar-bh'), + arDz(value: 'ar-dz'), + arEg(value: 'ar-eg'), + arIq(value: 'ar-iq'), + arJo(value: 'ar-jo'), + arKw(value: 'ar-kw'), + arLb(value: 'ar-lb'), + arLy(value: 'ar-ly'), + arMa(value: 'ar-ma'), + arOm(value: 'ar-om'), + arQa(value: 'ar-qa'), + arSa(value: 'ar-sa'), + arSy(value: 'ar-sy'), + arTn(value: 'ar-tn'), + arYe(value: 'ar-ye'), + xas(value: 'as'), + az(value: 'az'), + be(value: 'be'), + bg(value: 'bg'), + bh(value: 'bh'), + bn(value: 'bn'), + bs(value: 'bs'), + ca(value: 'ca'), + cs(value: 'cs'), + cy(value: 'cy'), + da(value: 'da'), + de(value: 'de'), + deAt(value: 'de-at'), + deCh(value: 'de-ch'), + deLi(value: 'de-li'), + deLu(value: 'de-lu'), + el(value: 'el'), + en(value: 'en'), + enAu(value: 'en-au'), + enBz(value: 'en-bz'), + enCa(value: 'en-ca'), + enGb(value: 'en-gb'), + enIe(value: 'en-ie'), + enJm(value: 'en-jm'), + enNz(value: 'en-nz'), + enTt(value: 'en-tt'), + enUs(value: 'en-us'), + enZa(value: 'en-za'), + eo(value: 'eo'), + es(value: 'es'), + esAr(value: 'es-ar'), + esBo(value: 'es-bo'), + esCl(value: 'es-cl'), + esCo(value: 'es-co'), + esCr(value: 'es-cr'), + esDo(value: 'es-do'), + esEc(value: 'es-ec'), + esGt(value: 'es-gt'), + esHn(value: 'es-hn'), + esMx(value: 'es-mx'), + esNi(value: 'es-ni'), + esPa(value: 'es-pa'), + esPe(value: 'es-pe'), + esPr(value: 'es-pr'), + esPy(value: 'es-py'), + esSv(value: 'es-sv'), + esUy(value: 'es-uy'), + esVe(value: 'es-ve'), + et(value: 'et'), + eu(value: 'eu'), + fa(value: 'fa'), + fi(value: 'fi'), + fo(value: 'fo'), + fr(value: 'fr'), + frBe(value: 'fr-be'), + frCa(value: 'fr-ca'), + frCh(value: 'fr-ch'), + frLu(value: 'fr-lu'), + ga(value: 'ga'), + gd(value: 'gd'), + he(value: 'he'), + hi(value: 'hi'), + hr(value: 'hr'), + hu(value: 'hu'), + id(value: 'id'), + xis(value: 'is'), + it(value: 'it'), + itCh(value: 'it-ch'), + ja(value: 'ja'), + ji(value: 'ji'), + ko(value: 'ko'), + ku(value: 'ku'), + lt(value: 'lt'), + lv(value: 'lv'), + mk(value: 'mk'), + ml(value: 'ml'), + ms(value: 'ms'), + mt(value: 'mt'), + nb(value: 'nb'), + ne(value: 'ne'), + nl(value: 'nl'), + nlBe(value: 'nl-be'), + nn(value: 'nn'), + no(value: 'no'), + pa(value: 'pa'), + pl(value: 'pl'), + pt(value: 'pt'), + ptBr(value: 'pt-br'), + rm(value: 'rm'), + ro(value: 'ro'), + roMd(value: 'ro-md'), + ru(value: 'ru'), + ruMd(value: 'ru-md'), + sb(value: 'sb'), + sk(value: 'sk'), + sl(value: 'sl'), + sq(value: 'sq'), + sr(value: 'sr'), + sv(value: 'sv'), + svFi(value: 'sv-fi'), + th(value: 'th'), + tn(value: 'tn'), + tr(value: 'tr'), + ts(value: 'ts'), + ua(value: 'ua'), + ur(value: 'ur'), + ve(value: 've'), + vi(value: 'vi'), + xh(value: 'xh'), + zhCn(value: 'zh-cn'), + zhHk(value: 'zh-hk'), + zhSg(value: 'zh-sg'), + zhTw(value: 'zh-tw'), + zu(value: 'zu'); - const EmailTemplateLocale({ - required this.value - }); + const EmailTemplateLocale({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/email_template_type.dart b/lib/src/enums/email_template_type.dart index ee291f99..2aaecb7d 100644 --- a/lib/src/enums/email_template_type.dart +++ b/lib/src/enums/email_template_type.dart @@ -1,19 +1,17 @@ part of '../../enums.dart'; enum EmailTemplateType { - verification(value: 'verification'), - magicSession(value: 'magicSession'), - recovery(value: 'recovery'), - invitation(value: 'invitation'), - mfaChallenge(value: 'mfaChallenge'), - sessionAlert(value: 'sessionAlert'), - otpSession(value: 'otpSession'); + verification(value: 'verification'), + magicSession(value: 'magicSession'), + recovery(value: 'recovery'), + invitation(value: 'invitation'), + mfaChallenge(value: 'mfaChallenge'), + sessionAlert(value: 'sessionAlert'), + otpSession(value: 'otpSession'); - const EmailTemplateType({ - required this.value - }); + const EmailTemplateType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/execution_method.dart b/lib/src/enums/execution_method.dart index 6ad112fe..44de4907 100644 --- a/lib/src/enums/execution_method.dart +++ b/lib/src/enums/execution_method.dart @@ -1,19 +1,17 @@ part of '../../enums.dart'; enum ExecutionMethod { - gET(value: 'GET'), - pOST(value: 'POST'), - pUT(value: 'PUT'), - pATCH(value: 'PATCH'), - dELETE(value: 'DELETE'), - oPTIONS(value: 'OPTIONS'), - hEAD(value: 'HEAD'); + gET(value: 'GET'), + pOST(value: 'POST'), + pUT(value: 'PUT'), + pATCH(value: 'PATCH'), + dELETE(value: 'DELETE'), + oPTIONS(value: 'OPTIONS'), + hEAD(value: 'HEAD'); - const ExecutionMethod({ - required this.value - }); + const ExecutionMethod({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/execution_status.dart b/lib/src/enums/execution_status.dart index f54859c9..7ea9865e 100644 --- a/lib/src/enums/execution_status.dart +++ b/lib/src/enums/execution_status.dart @@ -1,17 +1,15 @@ part of '../../enums.dart'; enum ExecutionStatus { - waiting(value: 'waiting'), - processing(value: 'processing'), - completed(value: 'completed'), - failed(value: 'failed'), - scheduled(value: 'scheduled'); + waiting(value: 'waiting'), + processing(value: 'processing'), + completed(value: 'completed'), + failed(value: 'failed'), + scheduled(value: 'scheduled'); - const ExecutionStatus({ - required this.value - }); + const ExecutionStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/execution_trigger.dart b/lib/src/enums/execution_trigger.dart index 8a14ae60..fb05eb7d 100644 --- a/lib/src/enums/execution_trigger.dart +++ b/lib/src/enums/execution_trigger.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum ExecutionTrigger { - http(value: 'http'), - schedule(value: 'schedule'), - event(value: 'event'); + http(value: 'http'), + schedule(value: 'schedule'), + event(value: 'event'); - const ExecutionTrigger({ - required this.value - }); + const ExecutionTrigger({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/flag.dart b/lib/src/enums/flag.dart index 27c25cac..a44cb81d 100644 --- a/lib/src/enums/flag.dart +++ b/lib/src/enums/flag.dart @@ -1,207 +1,205 @@ part of '../../enums.dart'; enum Flag { - afghanistan(value: 'af'), - angola(value: 'ao'), - albania(value: 'al'), - andorra(value: 'ad'), - unitedArabEmirates(value: 'ae'), - argentina(value: 'ar'), - armenia(value: 'am'), - antiguaAndBarbuda(value: 'ag'), - australia(value: 'au'), - austria(value: 'at'), - azerbaijan(value: 'az'), - burundi(value: 'bi'), - belgium(value: 'be'), - benin(value: 'bj'), - burkinaFaso(value: 'bf'), - bangladesh(value: 'bd'), - bulgaria(value: 'bg'), - bahrain(value: 'bh'), - bahamas(value: 'bs'), - bosniaAndHerzegovina(value: 'ba'), - belarus(value: 'by'), - belize(value: 'bz'), - bolivia(value: 'bo'), - brazil(value: 'br'), - barbados(value: 'bb'), - bruneiDarussalam(value: 'bn'), - bhutan(value: 'bt'), - botswana(value: 'bw'), - centralAfricanRepublic(value: 'cf'), - canada(value: 'ca'), - switzerland(value: 'ch'), - chile(value: 'cl'), - china(value: 'cn'), - coteDIvoire(value: 'ci'), - cameroon(value: 'cm'), - democraticRepublicOfTheCongo(value: 'cd'), - republicOfTheCongo(value: 'cg'), - colombia(value: 'co'), - comoros(value: 'km'), - capeVerde(value: 'cv'), - costaRica(value: 'cr'), - cuba(value: 'cu'), - cyprus(value: 'cy'), - czechRepublic(value: 'cz'), - germany(value: 'de'), - djibouti(value: 'dj'), - dominica(value: 'dm'), - denmark(value: 'dk'), - dominicanRepublic(value: 'do'), - algeria(value: 'dz'), - ecuador(value: 'ec'), - egypt(value: 'eg'), - eritrea(value: 'er'), - spain(value: 'es'), - estonia(value: 'ee'), - ethiopia(value: 'et'), - finland(value: 'fi'), - fiji(value: 'fj'), - france(value: 'fr'), - micronesiaFederatedStatesOf(value: 'fm'), - gabon(value: 'ga'), - unitedKingdom(value: 'gb'), - georgia(value: 'ge'), - ghana(value: 'gh'), - guinea(value: 'gn'), - gambia(value: 'gm'), - guineaBissau(value: 'gw'), - equatorialGuinea(value: 'gq'), - greece(value: 'gr'), - grenada(value: 'gd'), - guatemala(value: 'gt'), - guyana(value: 'gy'), - honduras(value: 'hn'), - croatia(value: 'hr'), - haiti(value: 'ht'), - hungary(value: 'hu'), - indonesia(value: 'id'), - india(value: 'in'), - ireland(value: 'ie'), - iranIslamicRepublicOf(value: 'ir'), - iraq(value: 'iq'), - iceland(value: 'is'), - israel(value: 'il'), - italy(value: 'it'), - jamaica(value: 'jm'), - jordan(value: 'jo'), - japan(value: 'jp'), - kazakhstan(value: 'kz'), - kenya(value: 'ke'), - kyrgyzstan(value: 'kg'), - cambodia(value: 'kh'), - kiribati(value: 'ki'), - saintKittsAndNevis(value: 'kn'), - southKorea(value: 'kr'), - kuwait(value: 'kw'), - laoPeopleSDemocraticRepublic(value: 'la'), - lebanon(value: 'lb'), - liberia(value: 'lr'), - libya(value: 'ly'), - saintLucia(value: 'lc'), - liechtenstein(value: 'li'), - sriLanka(value: 'lk'), - lesotho(value: 'ls'), - lithuania(value: 'lt'), - luxembourg(value: 'lu'), - latvia(value: 'lv'), - morocco(value: 'ma'), - monaco(value: 'mc'), - moldova(value: 'md'), - madagascar(value: 'mg'), - maldives(value: 'mv'), - mexico(value: 'mx'), - marshallIslands(value: 'mh'), - northMacedonia(value: 'mk'), - mali(value: 'ml'), - malta(value: 'mt'), - myanmar(value: 'mm'), - montenegro(value: 'me'), - mongolia(value: 'mn'), - mozambique(value: 'mz'), - mauritania(value: 'mr'), - mauritius(value: 'mu'), - malawi(value: 'mw'), - malaysia(value: 'my'), - namibia(value: 'na'), - niger(value: 'ne'), - nigeria(value: 'ng'), - nicaragua(value: 'ni'), - netherlands(value: 'nl'), - norway(value: 'no'), - nepal(value: 'np'), - nauru(value: 'nr'), - newZealand(value: 'nz'), - oman(value: 'om'), - pakistan(value: 'pk'), - panama(value: 'pa'), - peru(value: 'pe'), - philippines(value: 'ph'), - palau(value: 'pw'), - papuaNewGuinea(value: 'pg'), - poland(value: 'pl'), - frenchPolynesia(value: 'pf'), - northKorea(value: 'kp'), - portugal(value: 'pt'), - paraguay(value: 'py'), - qatar(value: 'qa'), - romania(value: 'ro'), - russia(value: 'ru'), - rwanda(value: 'rw'), - saudiArabia(value: 'sa'), - sudan(value: 'sd'), - senegal(value: 'sn'), - singapore(value: 'sg'), - solomonIslands(value: 'sb'), - sierraLeone(value: 'sl'), - elSalvador(value: 'sv'), - sanMarino(value: 'sm'), - somalia(value: 'so'), - serbia(value: 'rs'), - southSudan(value: 'ss'), - saoTomeAndPrincipe(value: 'st'), - suriname(value: 'sr'), - slovakia(value: 'sk'), - slovenia(value: 'si'), - sweden(value: 'se'), - eswatini(value: 'sz'), - seychelles(value: 'sc'), - syria(value: 'sy'), - chad(value: 'td'), - togo(value: 'tg'), - thailand(value: 'th'), - tajikistan(value: 'tj'), - turkmenistan(value: 'tm'), - timorLeste(value: 'tl'), - tonga(value: 'to'), - trinidadAndTobago(value: 'tt'), - tunisia(value: 'tn'), - turkey(value: 'tr'), - tuvalu(value: 'tv'), - tanzania(value: 'tz'), - uganda(value: 'ug'), - ukraine(value: 'ua'), - uruguay(value: 'uy'), - unitedStates(value: 'us'), - uzbekistan(value: 'uz'), - vaticanCity(value: 'va'), - saintVincentAndTheGrenadines(value: 'vc'), - venezuela(value: 've'), - vietnam(value: 'vn'), - vanuatu(value: 'vu'), - samoa(value: 'ws'), - yemen(value: 'ye'), - southAfrica(value: 'za'), - zambia(value: 'zm'), - zimbabwe(value: 'zw'); + afghanistan(value: 'af'), + angola(value: 'ao'), + albania(value: 'al'), + andorra(value: 'ad'), + unitedArabEmirates(value: 'ae'), + argentina(value: 'ar'), + armenia(value: 'am'), + antiguaAndBarbuda(value: 'ag'), + australia(value: 'au'), + austria(value: 'at'), + azerbaijan(value: 'az'), + burundi(value: 'bi'), + belgium(value: 'be'), + benin(value: 'bj'), + burkinaFaso(value: 'bf'), + bangladesh(value: 'bd'), + bulgaria(value: 'bg'), + bahrain(value: 'bh'), + bahamas(value: 'bs'), + bosniaAndHerzegovina(value: 'ba'), + belarus(value: 'by'), + belize(value: 'bz'), + bolivia(value: 'bo'), + brazil(value: 'br'), + barbados(value: 'bb'), + bruneiDarussalam(value: 'bn'), + bhutan(value: 'bt'), + botswana(value: 'bw'), + centralAfricanRepublic(value: 'cf'), + canada(value: 'ca'), + switzerland(value: 'ch'), + chile(value: 'cl'), + china(value: 'cn'), + coteDIvoire(value: 'ci'), + cameroon(value: 'cm'), + democraticRepublicOfTheCongo(value: 'cd'), + republicOfTheCongo(value: 'cg'), + colombia(value: 'co'), + comoros(value: 'km'), + capeVerde(value: 'cv'), + costaRica(value: 'cr'), + cuba(value: 'cu'), + cyprus(value: 'cy'), + czechRepublic(value: 'cz'), + germany(value: 'de'), + djibouti(value: 'dj'), + dominica(value: 'dm'), + denmark(value: 'dk'), + dominicanRepublic(value: 'do'), + algeria(value: 'dz'), + ecuador(value: 'ec'), + egypt(value: 'eg'), + eritrea(value: 'er'), + spain(value: 'es'), + estonia(value: 'ee'), + ethiopia(value: 'et'), + finland(value: 'fi'), + fiji(value: 'fj'), + france(value: 'fr'), + micronesiaFederatedStatesOf(value: 'fm'), + gabon(value: 'ga'), + unitedKingdom(value: 'gb'), + georgia(value: 'ge'), + ghana(value: 'gh'), + guinea(value: 'gn'), + gambia(value: 'gm'), + guineaBissau(value: 'gw'), + equatorialGuinea(value: 'gq'), + greece(value: 'gr'), + grenada(value: 'gd'), + guatemala(value: 'gt'), + guyana(value: 'gy'), + honduras(value: 'hn'), + croatia(value: 'hr'), + haiti(value: 'ht'), + hungary(value: 'hu'), + indonesia(value: 'id'), + india(value: 'in'), + ireland(value: 'ie'), + iranIslamicRepublicOf(value: 'ir'), + iraq(value: 'iq'), + iceland(value: 'is'), + israel(value: 'il'), + italy(value: 'it'), + jamaica(value: 'jm'), + jordan(value: 'jo'), + japan(value: 'jp'), + kazakhstan(value: 'kz'), + kenya(value: 'ke'), + kyrgyzstan(value: 'kg'), + cambodia(value: 'kh'), + kiribati(value: 'ki'), + saintKittsAndNevis(value: 'kn'), + southKorea(value: 'kr'), + kuwait(value: 'kw'), + laoPeopleSDemocraticRepublic(value: 'la'), + lebanon(value: 'lb'), + liberia(value: 'lr'), + libya(value: 'ly'), + saintLucia(value: 'lc'), + liechtenstein(value: 'li'), + sriLanka(value: 'lk'), + lesotho(value: 'ls'), + lithuania(value: 'lt'), + luxembourg(value: 'lu'), + latvia(value: 'lv'), + morocco(value: 'ma'), + monaco(value: 'mc'), + moldova(value: 'md'), + madagascar(value: 'mg'), + maldives(value: 'mv'), + mexico(value: 'mx'), + marshallIslands(value: 'mh'), + northMacedonia(value: 'mk'), + mali(value: 'ml'), + malta(value: 'mt'), + myanmar(value: 'mm'), + montenegro(value: 'me'), + mongolia(value: 'mn'), + mozambique(value: 'mz'), + mauritania(value: 'mr'), + mauritius(value: 'mu'), + malawi(value: 'mw'), + malaysia(value: 'my'), + namibia(value: 'na'), + niger(value: 'ne'), + nigeria(value: 'ng'), + nicaragua(value: 'ni'), + netherlands(value: 'nl'), + norway(value: 'no'), + nepal(value: 'np'), + nauru(value: 'nr'), + newZealand(value: 'nz'), + oman(value: 'om'), + pakistan(value: 'pk'), + panama(value: 'pa'), + peru(value: 'pe'), + philippines(value: 'ph'), + palau(value: 'pw'), + papuaNewGuinea(value: 'pg'), + poland(value: 'pl'), + frenchPolynesia(value: 'pf'), + northKorea(value: 'kp'), + portugal(value: 'pt'), + paraguay(value: 'py'), + qatar(value: 'qa'), + romania(value: 'ro'), + russia(value: 'ru'), + rwanda(value: 'rw'), + saudiArabia(value: 'sa'), + sudan(value: 'sd'), + senegal(value: 'sn'), + singapore(value: 'sg'), + solomonIslands(value: 'sb'), + sierraLeone(value: 'sl'), + elSalvador(value: 'sv'), + sanMarino(value: 'sm'), + somalia(value: 'so'), + serbia(value: 'rs'), + southSudan(value: 'ss'), + saoTomeAndPrincipe(value: 'st'), + suriname(value: 'sr'), + slovakia(value: 'sk'), + slovenia(value: 'si'), + sweden(value: 'se'), + eswatini(value: 'sz'), + seychelles(value: 'sc'), + syria(value: 'sy'), + chad(value: 'td'), + togo(value: 'tg'), + thailand(value: 'th'), + tajikistan(value: 'tj'), + turkmenistan(value: 'tm'), + timorLeste(value: 'tl'), + tonga(value: 'to'), + trinidadAndTobago(value: 'tt'), + tunisia(value: 'tn'), + turkey(value: 'tr'), + tuvalu(value: 'tv'), + tanzania(value: 'tz'), + uganda(value: 'ug'), + ukraine(value: 'ua'), + uruguay(value: 'uy'), + unitedStates(value: 'us'), + uzbekistan(value: 'uz'), + vaticanCity(value: 'va'), + saintVincentAndTheGrenadines(value: 'vc'), + venezuela(value: 've'), + vietnam(value: 'vn'), + vanuatu(value: 'vu'), + samoa(value: 'ws'), + yemen(value: 'ye'), + southAfrica(value: 'za'), + zambia(value: 'zm'), + zimbabwe(value: 'zw'); - const Flag({ - required this.value - }); + const Flag({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/framework.dart b/lib/src/enums/framework.dart index 03e25bed..a51b8580 100644 --- a/lib/src/enums/framework.dart +++ b/lib/src/enums/framework.dart @@ -1,27 +1,25 @@ part of '../../enums.dart'; enum Framework { - analog(value: 'analog'), - angular(value: 'angular'), - nextjs(value: 'nextjs'), - react(value: 'react'), - nuxt(value: 'nuxt'), - vue(value: 'vue'), - sveltekit(value: 'sveltekit'), - astro(value: 'astro'), - tanstackStart(value: 'tanstack-start'), - remix(value: 'remix'), - lynx(value: 'lynx'), - flutter(value: 'flutter'), - reactNative(value: 'react-native'), - vite(value: 'vite'), - other(value: 'other'); + analog(value: 'analog'), + angular(value: 'angular'), + nextjs(value: 'nextjs'), + react(value: 'react'), + nuxt(value: 'nuxt'), + vue(value: 'vue'), + sveltekit(value: 'sveltekit'), + astro(value: 'astro'), + tanstackStart(value: 'tanstack-start'), + remix(value: 'remix'), + lynx(value: 'lynx'), + flutter(value: 'flutter'), + reactNative(value: 'react-native'), + vite(value: 'vite'), + other(value: 'other'); - const Framework({ - required this.value - }); + const Framework({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/health_antivirus_status.dart b/lib/src/enums/health_antivirus_status.dart index 57b3cd9d..939e0f7d 100644 --- a/lib/src/enums/health_antivirus_status.dart +++ b/lib/src/enums/health_antivirus_status.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum HealthAntivirusStatus { - disabled(value: 'disabled'), - offline(value: 'offline'), - online(value: 'online'); + disabled(value: 'disabled'), + offline(value: 'offline'), + online(value: 'online'); - const HealthAntivirusStatus({ - required this.value - }); + const HealthAntivirusStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/health_check_status.dart b/lib/src/enums/health_check_status.dart index c20cdc7c..f21e793a 100644 --- a/lib/src/enums/health_check_status.dart +++ b/lib/src/enums/health_check_status.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum HealthCheckStatus { - pass(value: 'pass'), - fail(value: 'fail'); + pass(value: 'pass'), + fail(value: 'fail'); - const HealthCheckStatus({ - required this.value - }); + const HealthCheckStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/image_format.dart b/lib/src/enums/image_format.dart index 0f996ed9..55f4c5db 100644 --- a/lib/src/enums/image_format.dart +++ b/lib/src/enums/image_format.dart @@ -1,19 +1,17 @@ part of '../../enums.dart'; enum ImageFormat { - jpg(value: 'jpg'), - jpeg(value: 'jpeg'), - png(value: 'png'), - webp(value: 'webp'), - heic(value: 'heic'), - avif(value: 'avif'), - gif(value: 'gif'); + jpg(value: 'jpg'), + jpeg(value: 'jpeg'), + png(value: 'png'), + webp(value: 'webp'), + heic(value: 'heic'), + avif(value: 'avif'), + gif(value: 'gif'); - const ImageFormat({ - required this.value - }); + const ImageFormat({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/image_gravity.dart b/lib/src/enums/image_gravity.dart index 79bc4d62..88029044 100644 --- a/lib/src/enums/image_gravity.dart +++ b/lib/src/enums/image_gravity.dart @@ -1,21 +1,19 @@ part of '../../enums.dart'; enum ImageGravity { - center(value: 'center'), - topLeft(value: 'top-left'), - top(value: 'top'), - topRight(value: 'top-right'), - left(value: 'left'), - right(value: 'right'), - bottomLeft(value: 'bottom-left'), - bottom(value: 'bottom'), - bottomRight(value: 'bottom-right'); + center(value: 'center'), + topLeft(value: 'top-left'), + top(value: 'top'), + topRight(value: 'top-right'), + left(value: 'left'), + right(value: 'right'), + bottomLeft(value: 'bottom-left'), + bottom(value: 'bottom'), + bottomRight(value: 'bottom-right'); - const ImageGravity({ - required this.value - }); + const ImageGravity({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/index_status.dart b/lib/src/enums/index_status.dart index a1eef2e2..ccd6473a 100644 --- a/lib/src/enums/index_status.dart +++ b/lib/src/enums/index_status.dart @@ -1,17 +1,15 @@ part of '../../enums.dart'; enum IndexStatus { - available(value: 'available'), - processing(value: 'processing'), - deleting(value: 'deleting'), - stuck(value: 'stuck'), - failed(value: 'failed'); + available(value: 'available'), + processing(value: 'processing'), + deleting(value: 'deleting'), + stuck(value: 'stuck'), + failed(value: 'failed'); - const IndexStatus({ - required this.value - }); + const IndexStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/message_priority.dart b/lib/src/enums/message_priority.dart index 375913e8..a07e6f76 100644 --- a/lib/src/enums/message_priority.dart +++ b/lib/src/enums/message_priority.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum MessagePriority { - normal(value: 'normal'), - high(value: 'high'); + normal(value: 'normal'), + high(value: 'high'); - const MessagePriority({ - required this.value - }); + const MessagePriority({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/message_status.dart b/lib/src/enums/message_status.dart index 836796ef..e5ed35ce 100644 --- a/lib/src/enums/message_status.dart +++ b/lib/src/enums/message_status.dart @@ -1,17 +1,15 @@ part of '../../enums.dart'; enum MessageStatus { - draft(value: 'draft'), - processing(value: 'processing'), - scheduled(value: 'scheduled'), - sent(value: 'sent'), - failed(value: 'failed'); + draft(value: 'draft'), + processing(value: 'processing'), + scheduled(value: 'scheduled'), + sent(value: 'sent'), + failed(value: 'failed'); - const MessageStatus({ - required this.value - }); + const MessageStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/messaging_provider_type.dart b/lib/src/enums/messaging_provider_type.dart index a6859648..c69bf01e 100644 --- a/lib/src/enums/messaging_provider_type.dart +++ b/lib/src/enums/messaging_provider_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum MessagingProviderType { - email(value: 'email'), - sms(value: 'sms'), - push(value: 'push'); + email(value: 'email'), + sms(value: 'sms'), + push(value: 'push'); - const MessagingProviderType({ - required this.value - }); + const MessagingProviderType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/method_id.dart b/lib/src/enums/method_id.dart index f2cd1cde..26a316d6 100644 --- a/lib/src/enums/method_id.dart +++ b/lib/src/enums/method_id.dart @@ -1,19 +1,17 @@ part of '../../enums.dart'; enum MethodId { - emailPassword(value: 'email-password'), - magicUrl(value: 'magic-url'), - emailOtp(value: 'email-otp'), - anonymous(value: 'anonymous'), - invites(value: 'invites'), - jwt(value: 'jwt'), - phone(value: 'phone'); + emailPassword(value: 'email-password'), + magicUrl(value: 'magic-url'), + emailOtp(value: 'email-otp'), + anonymous(value: 'anonymous'), + invites(value: 'invites'), + jwt(value: 'jwt'), + phone(value: 'phone'); - const MethodId({ - required this.value - }); + const MethodId({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/name.dart b/lib/src/enums/name.dart index 9c4a8a40..d45eb4ef 100644 --- a/lib/src/enums/name.dart +++ b/lib/src/enums/name.dart @@ -1,25 +1,23 @@ part of '../../enums.dart'; enum Name { - v1Database(value: 'v1-database'), - v1Deletes(value: 'v1-deletes'), - v1Audits(value: 'v1-audits'), - v1Mails(value: 'v1-mails'), - v1Functions(value: 'v1-functions'), - v1StatsResources(value: 'v1-stats-resources'), - v1StatsUsage(value: 'v1-stats-usage'), - v1Webhooks(value: 'v1-webhooks'), - v1Certificates(value: 'v1-certificates'), - v1Builds(value: 'v1-builds'), - v1Screenshots(value: 'v1-screenshots'), - v1Messaging(value: 'v1-messaging'), - v1Migrations(value: 'v1-migrations'); + v1Database(value: 'v1-database'), + v1Deletes(value: 'v1-deletes'), + v1Audits(value: 'v1-audits'), + v1Mails(value: 'v1-mails'), + v1Functions(value: 'v1-functions'), + v1StatsResources(value: 'v1-stats-resources'), + v1StatsUsage(value: 'v1-stats-usage'), + v1Webhooks(value: 'v1-webhooks'), + v1Certificates(value: 'v1-certificates'), + v1Builds(value: 'v1-builds'), + v1Screenshots(value: 'v1-screenshots'), + v1Messaging(value: 'v1-messaging'), + v1Migrations(value: 'v1-migrations'); - const Name({ - required this.value - }); + const Name({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/o_auth_provider.dart b/lib/src/enums/o_auth_provider.dart index 8ed7ecff..b88e0a55 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -1,55 +1,53 @@ part of '../../enums.dart'; enum OAuthProvider { - amazon(value: 'amazon'), - apple(value: 'apple'), - auth0(value: 'auth0'), - authentik(value: 'authentik'), - autodesk(value: 'autodesk'), - bitbucket(value: 'bitbucket'), - bitly(value: 'bitly'), - box(value: 'box'), - dailymotion(value: 'dailymotion'), - discord(value: 'discord'), - disqus(value: 'disqus'), - dropbox(value: 'dropbox'), - etsy(value: 'etsy'), - facebook(value: 'facebook'), - figma(value: 'figma'), - fusionauth(value: 'fusionauth'), - github(value: 'github'), - gitlab(value: 'gitlab'), - google(value: 'google'), - keycloak(value: 'keycloak'), - kick(value: 'kick'), - linkedin(value: 'linkedin'), - microsoft(value: 'microsoft'), - notion(value: 'notion'), - oidc(value: 'oidc'), - okta(value: 'okta'), - paypal(value: 'paypal'), - paypalSandbox(value: 'paypalSandbox'), - podio(value: 'podio'), - salesforce(value: 'salesforce'), - slack(value: 'slack'), - spotify(value: 'spotify'), - stripe(value: 'stripe'), - tradeshift(value: 'tradeshift'), - tradeshiftBox(value: 'tradeshiftBox'), - twitch(value: 'twitch'), - wordpress(value: 'wordpress'), - x(value: 'x'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'); + amazon(value: 'amazon'), + apple(value: 'apple'), + auth0(value: 'auth0'), + authentik(value: 'authentik'), + autodesk(value: 'autodesk'), + bitbucket(value: 'bitbucket'), + bitly(value: 'bitly'), + box(value: 'box'), + dailymotion(value: 'dailymotion'), + discord(value: 'discord'), + disqus(value: 'disqus'), + dropbox(value: 'dropbox'), + etsy(value: 'etsy'), + facebook(value: 'facebook'), + figma(value: 'figma'), + fusionauth(value: 'fusionauth'), + github(value: 'github'), + gitlab(value: 'gitlab'), + google(value: 'google'), + keycloak(value: 'keycloak'), + kick(value: 'kick'), + linkedin(value: 'linkedin'), + microsoft(value: 'microsoft'), + notion(value: 'notion'), + oidc(value: 'oidc'), + okta(value: 'okta'), + paypal(value: 'paypal'), + paypalSandbox(value: 'paypalSandbox'), + podio(value: 'podio'), + salesforce(value: 'salesforce'), + slack(value: 'slack'), + spotify(value: 'spotify'), + stripe(value: 'stripe'), + tradeshift(value: 'tradeshift'), + tradeshiftBox(value: 'tradeshiftBox'), + twitch(value: 'twitch'), + wordpress(value: 'wordpress'), + x(value: 'x'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'); - const OAuthProvider({ - required this.value - }); + const OAuthProvider({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/order_by.dart b/lib/src/enums/order_by.dart index 661a419e..c99546cc 100644 --- a/lib/src/enums/order_by.dart +++ b/lib/src/enums/order_by.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum OrderBy { - asc(value: 'asc'), - desc(value: 'desc'); + asc(value: 'asc'), + desc(value: 'desc'); - const OrderBy({ - required this.value - }); + const OrderBy({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/password_hash.dart b/lib/src/enums/password_hash.dart index 510ee260..9d98c26a 100644 --- a/lib/src/enums/password_hash.dart +++ b/lib/src/enums/password_hash.dart @@ -1,23 +1,21 @@ part of '../../enums.dart'; enum PasswordHash { - sha1(value: 'sha1'), - sha224(value: 'sha224'), - sha256(value: 'sha256'), - sha384(value: 'sha384'), - sha512224(value: 'sha512/224'), - sha512256(value: 'sha512/256'), - sha512(value: 'sha512'), - sha3224(value: 'sha3-224'), - sha3256(value: 'sha3-256'), - sha3384(value: 'sha3-384'), - sha3512(value: 'sha3-512'); + sha1(value: 'sha1'), + sha224(value: 'sha224'), + sha256(value: 'sha256'), + sha384(value: 'sha384'), + sha512224(value: 'sha512/224'), + sha512256(value: 'sha512/256'), + sha512(value: 'sha512'), + sha3224(value: 'sha3-224'), + sha3256(value: 'sha3-256'), + sha3384(value: 'sha3-384'), + sha3512(value: 'sha3-512'); - const PasswordHash({ - required this.value - }); + const PasswordHash({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/platform_type.dart b/lib/src/enums/platform_type.dart index 216711d5..8b3c8f08 100644 --- a/lib/src/enums/platform_type.dart +++ b/lib/src/enums/platform_type.dart @@ -1,17 +1,15 @@ part of '../../enums.dart'; enum PlatformType { - windows(value: 'windows'), - apple(value: 'apple'), - android(value: 'android'), - linux(value: 'linux'), - web(value: 'web'); + windows(value: 'windows'), + apple(value: 'apple'), + android(value: 'android'), + linux(value: 'linux'), + web(value: 'web'); - const PlatformType({ - required this.value - }); + const PlatformType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/policy_id.dart b/lib/src/enums/policy_id.dart index 2c48a989..ef8f54f0 100644 --- a/lib/src/enums/policy_id.dart +++ b/lib/src/enums/policy_id.dart @@ -1,21 +1,19 @@ part of '../../enums.dart'; enum PolicyId { - passwordDictionary(value: 'password-dictionary'), - passwordHistory(value: 'password-history'), - passwordPersonalData(value: 'password-personal-data'), - sessionAlert(value: 'session-alert'), - sessionDuration(value: 'session-duration'), - sessionInvalidation(value: 'session-invalidation'), - sessionLimit(value: 'session-limit'), - userLimit(value: 'user-limit'), - membershipPrivacy(value: 'membership-privacy'); + passwordDictionary(value: 'password-dictionary'), + passwordHistory(value: 'password-history'), + passwordPersonalData(value: 'password-personal-data'), + sessionAlert(value: 'session-alert'), + sessionDuration(value: 'session-duration'), + sessionInvalidation(value: 'session-invalidation'), + sessionLimit(value: 'session-limit'), + userLimit(value: 'user-limit'), + membershipPrivacy(value: 'membership-privacy'); - const PolicyId({ - required this.value - }); + const PolicyId({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/protocol_id.dart b/lib/src/enums/protocol_id.dart index b36c067c..a9dea8c9 100644 --- a/lib/src/enums/protocol_id.dart +++ b/lib/src/enums/protocol_id.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum ProtocolId { - rest(value: 'rest'), - graphql(value: 'graphql'), - websocket(value: 'websocket'); + rest(value: 'rest'), + graphql(value: 'graphql'), + websocket(value: 'websocket'); - const ProtocolId({ - required this.value - }); + const ProtocolId({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/provider_id.dart b/lib/src/enums/provider_id.dart index 1aff211b..6137cae9 100644 --- a/lib/src/enums/provider_id.dart +++ b/lib/src/enums/provider_id.dart @@ -1,59 +1,57 @@ part of '../../enums.dart'; enum ProviderId { - amazon(value: 'amazon'), - apple(value: 'apple'), - auth0(value: 'auth0'), - authentik(value: 'authentik'), - autodesk(value: 'autodesk'), - bitbucket(value: 'bitbucket'), - bitly(value: 'bitly'), - box(value: 'box'), - dailymotion(value: 'dailymotion'), - discord(value: 'discord'), - disqus(value: 'disqus'), - dropbox(value: 'dropbox'), - etsy(value: 'etsy'), - facebook(value: 'facebook'), - figma(value: 'figma'), - fusionauth(value: 'fusionauth'), - github(value: 'github'), - gitlab(value: 'gitlab'), - google(value: 'google'), - keycloak(value: 'keycloak'), - kick(value: 'kick'), - linkedin(value: 'linkedin'), - microsoft(value: 'microsoft'), - notion(value: 'notion'), - oidc(value: 'oidc'), - okta(value: 'okta'), - paypal(value: 'paypal'), - paypalSandbox(value: 'paypalSandbox'), - podio(value: 'podio'), - salesforce(value: 'salesforce'), - slack(value: 'slack'), - spotify(value: 'spotify'), - stripe(value: 'stripe'), - tradeshift(value: 'tradeshift'), - tradeshiftBox(value: 'tradeshiftBox'), - twitch(value: 'twitch'), - wordpress(value: 'wordpress'), - x(value: 'x'), - yahoo(value: 'yahoo'), - yammer(value: 'yammer'), - yandex(value: 'yandex'), - zoho(value: 'zoho'), - zoom(value: 'zoom'), - mock(value: 'mock'), - mockUnverified(value: 'mock-unverified'), - githubImagine(value: 'githubImagine'), - googleImagine(value: 'googleImagine'); + amazon(value: 'amazon'), + apple(value: 'apple'), + auth0(value: 'auth0'), + authentik(value: 'authentik'), + autodesk(value: 'autodesk'), + bitbucket(value: 'bitbucket'), + bitly(value: 'bitly'), + box(value: 'box'), + dailymotion(value: 'dailymotion'), + discord(value: 'discord'), + disqus(value: 'disqus'), + dropbox(value: 'dropbox'), + etsy(value: 'etsy'), + facebook(value: 'facebook'), + figma(value: 'figma'), + fusionauth(value: 'fusionauth'), + github(value: 'github'), + gitlab(value: 'gitlab'), + google(value: 'google'), + keycloak(value: 'keycloak'), + kick(value: 'kick'), + linkedin(value: 'linkedin'), + microsoft(value: 'microsoft'), + notion(value: 'notion'), + oidc(value: 'oidc'), + okta(value: 'okta'), + paypal(value: 'paypal'), + paypalSandbox(value: 'paypalSandbox'), + podio(value: 'podio'), + salesforce(value: 'salesforce'), + slack(value: 'slack'), + spotify(value: 'spotify'), + stripe(value: 'stripe'), + tradeshift(value: 'tradeshift'), + tradeshiftBox(value: 'tradeshiftBox'), + twitch(value: 'twitch'), + wordpress(value: 'wordpress'), + x(value: 'x'), + yahoo(value: 'yahoo'), + yammer(value: 'yammer'), + yandex(value: 'yandex'), + zoho(value: 'zoho'), + zoom(value: 'zoom'), + mock(value: 'mock'), + mockUnverified(value: 'mock-unverified'), + githubImagine(value: 'githubImagine'), + googleImagine(value: 'googleImagine'); - const ProviderId({ - required this.value - }); + const ProviderId({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/proxy_resource_type.dart b/lib/src/enums/proxy_resource_type.dart index bce51db3..129fed5a 100644 --- a/lib/src/enums/proxy_resource_type.dart +++ b/lib/src/enums/proxy_resource_type.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum ProxyResourceType { - site(value: 'site'), - function(value: 'function'); + site(value: 'site'), + function(value: 'function'); - const ProxyResourceType({ - required this.value - }); + const ProxyResourceType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/proxy_rule_deployment_resource_type.dart b/lib/src/enums/proxy_rule_deployment_resource_type.dart index 963676d0..aa2cda9f 100644 --- a/lib/src/enums/proxy_rule_deployment_resource_type.dart +++ b/lib/src/enums/proxy_rule_deployment_resource_type.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum ProxyRuleDeploymentResourceType { - function(value: 'function'), - site(value: 'site'); + function(value: 'function'), + site(value: 'site'); - const ProxyRuleDeploymentResourceType({ - required this.value - }); + const ProxyRuleDeploymentResourceType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/proxy_rule_status.dart b/lib/src/enums/proxy_rule_status.dart index a13a2c65..5ebf31ed 100644 --- a/lib/src/enums/proxy_rule_status.dart +++ b/lib/src/enums/proxy_rule_status.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum ProxyRuleStatus { - unverified(value: 'unverified'), - verifying(value: 'verifying'), - verified(value: 'verified'); + unverified(value: 'unverified'), + verifying(value: 'verifying'), + verified(value: 'verified'); - const ProxyRuleStatus({ - required this.value - }); + const ProxyRuleStatus({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/relation_mutate.dart b/lib/src/enums/relation_mutate.dart index 9f4c1a85..b215a8fa 100644 --- a/lib/src/enums/relation_mutate.dart +++ b/lib/src/enums/relation_mutate.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum RelationMutate { - cascade(value: 'cascade'), - restrict(value: 'restrict'), - setNull(value: 'setNull'); + cascade(value: 'cascade'), + restrict(value: 'restrict'), + setNull(value: 'setNull'); - const RelationMutate({ - required this.value - }); + const RelationMutate({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/relationship_type.dart b/lib/src/enums/relationship_type.dart index 301bc61d..30efc944 100644 --- a/lib/src/enums/relationship_type.dart +++ b/lib/src/enums/relationship_type.dart @@ -1,16 +1,14 @@ part of '../../enums.dart'; enum RelationshipType { - oneToOne(value: 'oneToOne'), - manyToOne(value: 'manyToOne'), - manyToMany(value: 'manyToMany'), - oneToMany(value: 'oneToMany'); + oneToOne(value: 'oneToOne'), + manyToOne(value: 'manyToOne'), + manyToMany(value: 'manyToMany'), + oneToMany(value: 'oneToMany'); - const RelationshipType({ - required this.value - }); + const RelationshipType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/runtime.dart b/lib/src/enums/runtime.dart index 9afcc99f..8acfd913 100644 --- a/lib/src/enums/runtime.dart +++ b/lib/src/enums/runtime.dart @@ -1,101 +1,99 @@ part of '../../enums.dart'; enum Runtime { - node145(value: 'node-14.5'), - node160(value: 'node-16.0'), - node180(value: 'node-18.0'), - node190(value: 'node-19.0'), - node200(value: 'node-20.0'), - node210(value: 'node-21.0'), - node22(value: 'node-22'), - node23(value: 'node-23'), - node24(value: 'node-24'), - node25(value: 'node-25'), - php80(value: 'php-8.0'), - php81(value: 'php-8.1'), - php82(value: 'php-8.2'), - php83(value: 'php-8.3'), - php84(value: 'php-8.4'), - ruby30(value: 'ruby-3.0'), - ruby31(value: 'ruby-3.1'), - ruby32(value: 'ruby-3.2'), - ruby33(value: 'ruby-3.3'), - ruby34(value: 'ruby-3.4'), - ruby40(value: 'ruby-4.0'), - python38(value: 'python-3.8'), - python39(value: 'python-3.9'), - python310(value: 'python-3.10'), - python311(value: 'python-3.11'), - python312(value: 'python-3.12'), - python313(value: 'python-3.13'), - python314(value: 'python-3.14'), - pythonMl311(value: 'python-ml-3.11'), - pythonMl312(value: 'python-ml-3.12'), - pythonMl313(value: 'python-ml-3.13'), - deno140(value: 'deno-1.40'), - deno146(value: 'deno-1.46'), - deno20(value: 'deno-2.0'), - deno25(value: 'deno-2.5'), - deno26(value: 'deno-2.6'), - dart215(value: 'dart-2.15'), - dart216(value: 'dart-2.16'), - dart217(value: 'dart-2.17'), - dart218(value: 'dart-2.18'), - dart219(value: 'dart-2.19'), - dart30(value: 'dart-3.0'), - dart31(value: 'dart-3.1'), - dart33(value: 'dart-3.3'), - dart35(value: 'dart-3.5'), - dart38(value: 'dart-3.8'), - dart39(value: 'dart-3.9'), - dart310(value: 'dart-3.10'), - dart311(value: 'dart-3.11'), - dotnet60(value: 'dotnet-6.0'), - dotnet70(value: 'dotnet-7.0'), - dotnet80(value: 'dotnet-8.0'), - dotnet10(value: 'dotnet-10'), - java80(value: 'java-8.0'), - java110(value: 'java-11.0'), - java170(value: 'java-17.0'), - java180(value: 'java-18.0'), - java210(value: 'java-21.0'), - java22(value: 'java-22'), - java25(value: 'java-25'), - swift55(value: 'swift-5.5'), - swift58(value: 'swift-5.8'), - swift59(value: 'swift-5.9'), - swift510(value: 'swift-5.10'), - swift62(value: 'swift-6.2'), - kotlin16(value: 'kotlin-1.6'), - kotlin18(value: 'kotlin-1.8'), - kotlin19(value: 'kotlin-1.9'), - kotlin20(value: 'kotlin-2.0'), - kotlin23(value: 'kotlin-2.3'), - cpp17(value: 'cpp-17'), - cpp20(value: 'cpp-20'), - bun10(value: 'bun-1.0'), - bun11(value: 'bun-1.1'), - bun12(value: 'bun-1.2'), - bun13(value: 'bun-1.3'), - go123(value: 'go-1.23'), - go124(value: 'go-1.24'), - go125(value: 'go-1.25'), - go126(value: 'go-1.26'), - rust183(value: 'rust-1.83'), - static1(value: 'static-1'), - flutter324(value: 'flutter-3.24'), - flutter327(value: 'flutter-3.27'), - flutter329(value: 'flutter-3.29'), - flutter332(value: 'flutter-3.32'), - flutter335(value: 'flutter-3.35'), - flutter338(value: 'flutter-3.38'), - flutter341(value: 'flutter-3.41'); + node145(value: 'node-14.5'), + node160(value: 'node-16.0'), + node180(value: 'node-18.0'), + node190(value: 'node-19.0'), + node200(value: 'node-20.0'), + node210(value: 'node-21.0'), + node22(value: 'node-22'), + node23(value: 'node-23'), + node24(value: 'node-24'), + node25(value: 'node-25'), + php80(value: 'php-8.0'), + php81(value: 'php-8.1'), + php82(value: 'php-8.2'), + php83(value: 'php-8.3'), + php84(value: 'php-8.4'), + ruby30(value: 'ruby-3.0'), + ruby31(value: 'ruby-3.1'), + ruby32(value: 'ruby-3.2'), + ruby33(value: 'ruby-3.3'), + ruby34(value: 'ruby-3.4'), + ruby40(value: 'ruby-4.0'), + python38(value: 'python-3.8'), + python39(value: 'python-3.9'), + python310(value: 'python-3.10'), + python311(value: 'python-3.11'), + python312(value: 'python-3.12'), + python313(value: 'python-3.13'), + python314(value: 'python-3.14'), + pythonMl311(value: 'python-ml-3.11'), + pythonMl312(value: 'python-ml-3.12'), + pythonMl313(value: 'python-ml-3.13'), + deno140(value: 'deno-1.40'), + deno146(value: 'deno-1.46'), + deno20(value: 'deno-2.0'), + deno25(value: 'deno-2.5'), + deno26(value: 'deno-2.6'), + dart215(value: 'dart-2.15'), + dart216(value: 'dart-2.16'), + dart217(value: 'dart-2.17'), + dart218(value: 'dart-2.18'), + dart219(value: 'dart-2.19'), + dart30(value: 'dart-3.0'), + dart31(value: 'dart-3.1'), + dart33(value: 'dart-3.3'), + dart35(value: 'dart-3.5'), + dart38(value: 'dart-3.8'), + dart39(value: 'dart-3.9'), + dart310(value: 'dart-3.10'), + dart311(value: 'dart-3.11'), + dotnet60(value: 'dotnet-6.0'), + dotnet70(value: 'dotnet-7.0'), + dotnet80(value: 'dotnet-8.0'), + dotnet10(value: 'dotnet-10'), + java80(value: 'java-8.0'), + java110(value: 'java-11.0'), + java170(value: 'java-17.0'), + java180(value: 'java-18.0'), + java210(value: 'java-21.0'), + java22(value: 'java-22'), + java25(value: 'java-25'), + swift55(value: 'swift-5.5'), + swift58(value: 'swift-5.8'), + swift59(value: 'swift-5.9'), + swift510(value: 'swift-5.10'), + swift62(value: 'swift-6.2'), + kotlin16(value: 'kotlin-1.6'), + kotlin18(value: 'kotlin-1.8'), + kotlin19(value: 'kotlin-1.9'), + kotlin20(value: 'kotlin-2.0'), + kotlin23(value: 'kotlin-2.3'), + cpp17(value: 'cpp-17'), + cpp20(value: 'cpp-20'), + bun10(value: 'bun-1.0'), + bun11(value: 'bun-1.1'), + bun12(value: 'bun-1.2'), + bun13(value: 'bun-1.3'), + go123(value: 'go-1.23'), + go124(value: 'go-1.24'), + go125(value: 'go-1.25'), + go126(value: 'go-1.26'), + rust183(value: 'rust-1.83'), + static1(value: 'static-1'), + flutter324(value: 'flutter-3.24'), + flutter327(value: 'flutter-3.27'), + flutter329(value: 'flutter-3.29'), + flutter332(value: 'flutter-3.32'), + flutter335(value: 'flutter-3.35'), + flutter338(value: 'flutter-3.38'), + flutter341(value: 'flutter-3.41'); - const Runtime({ - required this.value - }); + const Runtime({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/scopes.dart b/lib/src/enums/scopes.dart index 7834dba9..42844a2e 100644 --- a/lib/src/enums/scopes.dart +++ b/lib/src/enums/scopes.dart @@ -1,101 +1,99 @@ part of '../../enums.dart'; enum Scopes { - projectRead(value: 'project.read'), - projectWrite(value: 'project.write'), - keysRead(value: 'keys.read'), - keysWrite(value: 'keys.write'), - platformsRead(value: 'platforms.read'), - platformsWrite(value: 'platforms.write'), - mocksRead(value: 'mocks.read'), - mocksWrite(value: 'mocks.write'), - policiesRead(value: 'policies.read'), - policiesWrite(value: 'policies.write'), - projectPoliciesRead(value: 'project.policies.read'), - projectPoliciesWrite(value: 'project.policies.write'), - templatesRead(value: 'templates.read'), - templatesWrite(value: 'templates.write'), - oauth2Read(value: 'oauth2.read'), - oauth2Write(value: 'oauth2.write'), - usersRead(value: 'users.read'), - usersWrite(value: 'users.write'), - sessionsRead(value: 'sessions.read'), - sessionsWrite(value: 'sessions.write'), - teamsRead(value: 'teams.read'), - teamsWrite(value: 'teams.write'), - databasesRead(value: 'databases.read'), - databasesWrite(value: 'databases.write'), - tablesRead(value: 'tables.read'), - tablesWrite(value: 'tables.write'), - columnsRead(value: 'columns.read'), - columnsWrite(value: 'columns.write'), - indexesRead(value: 'indexes.read'), - indexesWrite(value: 'indexes.write'), - rowsRead(value: 'rows.read'), - rowsWrite(value: 'rows.write'), - collectionsRead(value: 'collections.read'), - collectionsWrite(value: 'collections.write'), - attributesRead(value: 'attributes.read'), - attributesWrite(value: 'attributes.write'), - documentsRead(value: 'documents.read'), - documentsWrite(value: 'documents.write'), - bucketsRead(value: 'buckets.read'), - bucketsWrite(value: 'buckets.write'), - filesRead(value: 'files.read'), - filesWrite(value: 'files.write'), - tokensRead(value: 'tokens.read'), - tokensWrite(value: 'tokens.write'), - functionsRead(value: 'functions.read'), - functionsWrite(value: 'functions.write'), - executionsRead(value: 'executions.read'), - executionsWrite(value: 'executions.write'), - executionRead(value: 'execution.read'), - executionWrite(value: 'execution.write'), - sitesRead(value: 'sites.read'), - sitesWrite(value: 'sites.write'), - logRead(value: 'log.read'), - logWrite(value: 'log.write'), - providersRead(value: 'providers.read'), - providersWrite(value: 'providers.write'), - topicsRead(value: 'topics.read'), - topicsWrite(value: 'topics.write'), - subscribersRead(value: 'subscribers.read'), - subscribersWrite(value: 'subscribers.write'), - targetsRead(value: 'targets.read'), - targetsWrite(value: 'targets.write'), - messagesRead(value: 'messages.read'), - messagesWrite(value: 'messages.write'), - rulesRead(value: 'rules.read'), - rulesWrite(value: 'rules.write'), - webhooksRead(value: 'webhooks.read'), - webhooksWrite(value: 'webhooks.write'), - localeRead(value: 'locale.read'), - avatarsRead(value: 'avatars.read'), - healthRead(value: 'health.read'), - assistantRead(value: 'assistant.read'), - migrationsRead(value: 'migrations.read'), - migrationsWrite(value: 'migrations.write'), - schedulesRead(value: 'schedules.read'), - schedulesWrite(value: 'schedules.write'), - vcsRead(value: 'vcs.read'), - vcsWrite(value: 'vcs.write'), - presencesRead(value: 'presences.read'), - presencesWrite(value: 'presences.write'), - backupsPoliciesRead(value: 'backups.policies.read'), - backupsPoliciesWrite(value: 'backups.policies.write'), - archivesRead(value: 'archives.read'), - archivesWrite(value: 'archives.write'), - restorationsRead(value: 'restorations.read'), - restorationsWrite(value: 'restorations.write'), - domainsRead(value: 'domains.read'), - domainsWrite(value: 'domains.write'), - eventsRead(value: 'events.read'); + projectRead(value: 'project.read'), + projectWrite(value: 'project.write'), + keysRead(value: 'keys.read'), + keysWrite(value: 'keys.write'), + platformsRead(value: 'platforms.read'), + platformsWrite(value: 'platforms.write'), + mocksRead(value: 'mocks.read'), + mocksWrite(value: 'mocks.write'), + policiesRead(value: 'policies.read'), + policiesWrite(value: 'policies.write'), + projectPoliciesRead(value: 'project.policies.read'), + projectPoliciesWrite(value: 'project.policies.write'), + templatesRead(value: 'templates.read'), + templatesWrite(value: 'templates.write'), + oauth2Read(value: 'oauth2.read'), + oauth2Write(value: 'oauth2.write'), + usersRead(value: 'users.read'), + usersWrite(value: 'users.write'), + sessionsRead(value: 'sessions.read'), + sessionsWrite(value: 'sessions.write'), + teamsRead(value: 'teams.read'), + teamsWrite(value: 'teams.write'), + databasesRead(value: 'databases.read'), + databasesWrite(value: 'databases.write'), + tablesRead(value: 'tables.read'), + tablesWrite(value: 'tables.write'), + columnsRead(value: 'columns.read'), + columnsWrite(value: 'columns.write'), + indexesRead(value: 'indexes.read'), + indexesWrite(value: 'indexes.write'), + rowsRead(value: 'rows.read'), + rowsWrite(value: 'rows.write'), + collectionsRead(value: 'collections.read'), + collectionsWrite(value: 'collections.write'), + attributesRead(value: 'attributes.read'), + attributesWrite(value: 'attributes.write'), + documentsRead(value: 'documents.read'), + documentsWrite(value: 'documents.write'), + bucketsRead(value: 'buckets.read'), + bucketsWrite(value: 'buckets.write'), + filesRead(value: 'files.read'), + filesWrite(value: 'files.write'), + tokensRead(value: 'tokens.read'), + tokensWrite(value: 'tokens.write'), + functionsRead(value: 'functions.read'), + functionsWrite(value: 'functions.write'), + executionsRead(value: 'executions.read'), + executionsWrite(value: 'executions.write'), + executionRead(value: 'execution.read'), + executionWrite(value: 'execution.write'), + sitesRead(value: 'sites.read'), + sitesWrite(value: 'sites.write'), + logRead(value: 'log.read'), + logWrite(value: 'log.write'), + providersRead(value: 'providers.read'), + providersWrite(value: 'providers.write'), + topicsRead(value: 'topics.read'), + topicsWrite(value: 'topics.write'), + subscribersRead(value: 'subscribers.read'), + subscribersWrite(value: 'subscribers.write'), + targetsRead(value: 'targets.read'), + targetsWrite(value: 'targets.write'), + messagesRead(value: 'messages.read'), + messagesWrite(value: 'messages.write'), + rulesRead(value: 'rules.read'), + rulesWrite(value: 'rules.write'), + webhooksRead(value: 'webhooks.read'), + webhooksWrite(value: 'webhooks.write'), + localeRead(value: 'locale.read'), + avatarsRead(value: 'avatars.read'), + healthRead(value: 'health.read'), + assistantRead(value: 'assistant.read'), + migrationsRead(value: 'migrations.read'), + migrationsWrite(value: 'migrations.write'), + schedulesRead(value: 'schedules.read'), + schedulesWrite(value: 'schedules.write'), + vcsRead(value: 'vcs.read'), + vcsWrite(value: 'vcs.write'), + presencesRead(value: 'presences.read'), + presencesWrite(value: 'presences.write'), + backupsPoliciesRead(value: 'backups.policies.read'), + backupsPoliciesWrite(value: 'backups.policies.write'), + archivesRead(value: 'archives.read'), + archivesWrite(value: 'archives.write'), + restorationsRead(value: 'restorations.read'), + restorationsWrite(value: 'restorations.write'), + domainsRead(value: 'domains.read'), + domainsWrite(value: 'domains.write'), + eventsRead(value: 'events.read'); - const Scopes({ - required this.value - }); + const Scopes({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/secure.dart b/lib/src/enums/secure.dart index 754d242a..a490e94f 100644 --- a/lib/src/enums/secure.dart +++ b/lib/src/enums/secure.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum Secure { - tls(value: 'tls'), - ssl(value: 'ssl'); + tls(value: 'tls'), + ssl(value: 'ssl'); - const Secure({ - required this.value - }); + const Secure({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/service_id.dart b/lib/src/enums/service_id.dart index 8888a1ee..35c37fe8 100644 --- a/lib/src/enums/service_id.dart +++ b/lib/src/enums/service_id.dart @@ -1,29 +1,27 @@ part of '../../enums.dart'; enum ServiceId { - account(value: 'account'), - avatars(value: 'avatars'), - databases(value: 'databases'), - tablesdb(value: 'tablesdb'), - locale(value: 'locale'), - health(value: 'health'), - project(value: 'project'), - storage(value: 'storage'), - teams(value: 'teams'), - users(value: 'users'), - vcs(value: 'vcs'), - sites(value: 'sites'), - functions(value: 'functions'), - proxy(value: 'proxy'), - graphql(value: 'graphql'), - migrations(value: 'migrations'), - messaging(value: 'messaging'); + account(value: 'account'), + avatars(value: 'avatars'), + databases(value: 'databases'), + tablesdb(value: 'tablesdb'), + locale(value: 'locale'), + health(value: 'health'), + project(value: 'project'), + storage(value: 'storage'), + teams(value: 'teams'), + users(value: 'users'), + vcs(value: 'vcs'), + sites(value: 'sites'), + functions(value: 'functions'), + proxy(value: 'proxy'), + graphql(value: 'graphql'), + migrations(value: 'migrations'), + messaging(value: 'messaging'); - const ServiceId({ - required this.value - }); + const ServiceId({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/smtp_encryption.dart b/lib/src/enums/smtp_encryption.dart index 6c880ed6..cb6cee26 100644 --- a/lib/src/enums/smtp_encryption.dart +++ b/lib/src/enums/smtp_encryption.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum SmtpEncryption { - none(value: 'none'), - ssl(value: 'ssl'), - tls(value: 'tls'); + none(value: 'none'), + ssl(value: 'ssl'), + tls(value: 'tls'); - const SmtpEncryption({ - required this.value - }); + const SmtpEncryption({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/status_code.dart b/lib/src/enums/status_code.dart index 8273d8ee..b4c7c591 100644 --- a/lib/src/enums/status_code.dart +++ b/lib/src/enums/status_code.dart @@ -1,16 +1,14 @@ part of '../../enums.dart'; enum StatusCode { - movedPermanently301(value: '301'), - found302(value: '302'), - temporaryRedirect307(value: '307'), - permanentRedirect308(value: '308'); + movedPermanently301(value: '301'), + found302(value: '302'), + temporaryRedirect307(value: '307'), + permanentRedirect308(value: '308'); - const StatusCode({ - required this.value - }); + const StatusCode({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/tables_db_index_type.dart b/lib/src/enums/tables_db_index_type.dart index 654ff3af..77bec7a8 100644 --- a/lib/src/enums/tables_db_index_type.dart +++ b/lib/src/enums/tables_db_index_type.dart @@ -1,16 +1,14 @@ part of '../../enums.dart'; enum TablesDBIndexType { - key(value: 'key'), - fulltext(value: 'fulltext'), - unique(value: 'unique'), - spatial(value: 'spatial'); + key(value: 'key'), + fulltext(value: 'fulltext'), + unique(value: 'unique'), + spatial(value: 'spatial'); - const TablesDBIndexType({ - required this.value - }); + const TablesDBIndexType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/template_reference_type.dart b/lib/src/enums/template_reference_type.dart index 3c0a2d90..e688d654 100644 --- a/lib/src/enums/template_reference_type.dart +++ b/lib/src/enums/template_reference_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum TemplateReferenceType { - commit(value: 'commit'), - branch(value: 'branch'), - tag(value: 'tag'); + commit(value: 'commit'), + branch(value: 'branch'), + tag(value: 'tag'); - const TemplateReferenceType({ - required this.value - }); + const TemplateReferenceType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/theme.dart b/lib/src/enums/theme.dart index 1100e45f..979320f1 100644 --- a/lib/src/enums/theme.dart +++ b/lib/src/enums/theme.dart @@ -1,14 +1,12 @@ part of '../../enums.dart'; enum Theme { - light(value: 'light'), - dark(value: 'dark'); + light(value: 'light'), + dark(value: 'dark'); - const Theme({ - required this.value - }); + const Theme({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/timezone.dart b/lib/src/enums/timezone.dart index 4a8de1ce..d5d8d94a 100644 --- a/lib/src/enums/timezone.dart +++ b/lib/src/enums/timezone.dart @@ -1,431 +1,429 @@ part of '../../enums.dart'; enum Timezone { - africaAbidjan(value: 'africa/abidjan'), - africaAccra(value: 'africa/accra'), - africaAddisAbaba(value: 'africa/addis_ababa'), - africaAlgiers(value: 'africa/algiers'), - africaAsmara(value: 'africa/asmara'), - africaBamako(value: 'africa/bamako'), - africaBangui(value: 'africa/bangui'), - africaBanjul(value: 'africa/banjul'), - africaBissau(value: 'africa/bissau'), - africaBlantyre(value: 'africa/blantyre'), - africaBrazzaville(value: 'africa/brazzaville'), - africaBujumbura(value: 'africa/bujumbura'), - africaCairo(value: 'africa/cairo'), - africaCasablanca(value: 'africa/casablanca'), - africaCeuta(value: 'africa/ceuta'), - africaConakry(value: 'africa/conakry'), - africaDakar(value: 'africa/dakar'), - africaDarEsSalaam(value: 'africa/dar_es_salaam'), - africaDjibouti(value: 'africa/djibouti'), - africaDouala(value: 'africa/douala'), - africaElAaiun(value: 'africa/el_aaiun'), - africaFreetown(value: 'africa/freetown'), - africaGaborone(value: 'africa/gaborone'), - africaHarare(value: 'africa/harare'), - africaJohannesburg(value: 'africa/johannesburg'), - africaJuba(value: 'africa/juba'), - africaKampala(value: 'africa/kampala'), - africaKhartoum(value: 'africa/khartoum'), - africaKigali(value: 'africa/kigali'), - africaKinshasa(value: 'africa/kinshasa'), - africaLagos(value: 'africa/lagos'), - africaLibreville(value: 'africa/libreville'), - africaLome(value: 'africa/lome'), - africaLuanda(value: 'africa/luanda'), - africaLubumbashi(value: 'africa/lubumbashi'), - africaLusaka(value: 'africa/lusaka'), - africaMalabo(value: 'africa/malabo'), - africaMaputo(value: 'africa/maputo'), - africaMaseru(value: 'africa/maseru'), - africaMbabane(value: 'africa/mbabane'), - africaMogadishu(value: 'africa/mogadishu'), - africaMonrovia(value: 'africa/monrovia'), - africaNairobi(value: 'africa/nairobi'), - africaNdjamena(value: 'africa/ndjamena'), - africaNiamey(value: 'africa/niamey'), - africaNouakchott(value: 'africa/nouakchott'), - africaOuagadougou(value: 'africa/ouagadougou'), - africaPortoNovo(value: 'africa/porto-novo'), - africaSaoTome(value: 'africa/sao_tome'), - africaTripoli(value: 'africa/tripoli'), - africaTunis(value: 'africa/tunis'), - africaWindhoek(value: 'africa/windhoek'), - americaAdak(value: 'america/adak'), - americaAnchorage(value: 'america/anchorage'), - americaAnguilla(value: 'america/anguilla'), - americaAntigua(value: 'america/antigua'), - americaAraguaina(value: 'america/araguaina'), - americaArgentinaBuenosAires(value: 'america/argentina/buenos_aires'), - americaArgentinaCatamarca(value: 'america/argentina/catamarca'), - americaArgentinaCordoba(value: 'america/argentina/cordoba'), - americaArgentinaJujuy(value: 'america/argentina/jujuy'), - americaArgentinaLaRioja(value: 'america/argentina/la_rioja'), - americaArgentinaMendoza(value: 'america/argentina/mendoza'), - americaArgentinaRioGallegos(value: 'america/argentina/rio_gallegos'), - americaArgentinaSalta(value: 'america/argentina/salta'), - americaArgentinaSanJuan(value: 'america/argentina/san_juan'), - americaArgentinaSanLuis(value: 'america/argentina/san_luis'), - americaArgentinaTucuman(value: 'america/argentina/tucuman'), - americaArgentinaUshuaia(value: 'america/argentina/ushuaia'), - americaAruba(value: 'america/aruba'), - americaAsuncion(value: 'america/asuncion'), - americaAtikokan(value: 'america/atikokan'), - americaBahia(value: 'america/bahia'), - americaBahiaBanderas(value: 'america/bahia_banderas'), - americaBarbados(value: 'america/barbados'), - americaBelem(value: 'america/belem'), - americaBelize(value: 'america/belize'), - americaBlancSablon(value: 'america/blanc-sablon'), - americaBoaVista(value: 'america/boa_vista'), - americaBogota(value: 'america/bogota'), - americaBoise(value: 'america/boise'), - americaCambridgeBay(value: 'america/cambridge_bay'), - americaCampoGrande(value: 'america/campo_grande'), - americaCancun(value: 'america/cancun'), - americaCaracas(value: 'america/caracas'), - americaCayenne(value: 'america/cayenne'), - americaCayman(value: 'america/cayman'), - americaChicago(value: 'america/chicago'), - americaChihuahua(value: 'america/chihuahua'), - americaCiudadJuarez(value: 'america/ciudad_juarez'), - americaCostaRica(value: 'america/costa_rica'), - americaCoyhaique(value: 'america/coyhaique'), - americaCreston(value: 'america/creston'), - americaCuiaba(value: 'america/cuiaba'), - americaCuracao(value: 'america/curacao'), - americaDanmarkshavn(value: 'america/danmarkshavn'), - americaDawson(value: 'america/dawson'), - americaDawsonCreek(value: 'america/dawson_creek'), - americaDenver(value: 'america/denver'), - americaDetroit(value: 'america/detroit'), - americaDominica(value: 'america/dominica'), - americaEdmonton(value: 'america/edmonton'), - americaEirunepe(value: 'america/eirunepe'), - americaElSalvador(value: 'america/el_salvador'), - americaFortNelson(value: 'america/fort_nelson'), - americaFortaleza(value: 'america/fortaleza'), - americaGlaceBay(value: 'america/glace_bay'), - americaGooseBay(value: 'america/goose_bay'), - americaGrandTurk(value: 'america/grand_turk'), - americaGrenada(value: 'america/grenada'), - americaGuadeloupe(value: 'america/guadeloupe'), - americaGuatemala(value: 'america/guatemala'), - americaGuayaquil(value: 'america/guayaquil'), - americaGuyana(value: 'america/guyana'), - americaHalifax(value: 'america/halifax'), - americaHavana(value: 'america/havana'), - americaHermosillo(value: 'america/hermosillo'), - americaIndianaIndianapolis(value: 'america/indiana/indianapolis'), - americaIndianaKnox(value: 'america/indiana/knox'), - americaIndianaMarengo(value: 'america/indiana/marengo'), - americaIndianaPetersburg(value: 'america/indiana/petersburg'), - americaIndianaTellCity(value: 'america/indiana/tell_city'), - americaIndianaVevay(value: 'america/indiana/vevay'), - americaIndianaVincennes(value: 'america/indiana/vincennes'), - americaIndianaWinamac(value: 'america/indiana/winamac'), - americaInuvik(value: 'america/inuvik'), - americaIqaluit(value: 'america/iqaluit'), - americaJamaica(value: 'america/jamaica'), - americaJuneau(value: 'america/juneau'), - americaKentuckyLouisville(value: 'america/kentucky/louisville'), - americaKentuckyMonticello(value: 'america/kentucky/monticello'), - americaKralendijk(value: 'america/kralendijk'), - americaLaPaz(value: 'america/la_paz'), - americaLima(value: 'america/lima'), - americaLosAngeles(value: 'america/los_angeles'), - americaLowerPrinces(value: 'america/lower_princes'), - americaMaceio(value: 'america/maceio'), - americaManagua(value: 'america/managua'), - americaManaus(value: 'america/manaus'), - americaMarigot(value: 'america/marigot'), - americaMartinique(value: 'america/martinique'), - americaMatamoros(value: 'america/matamoros'), - americaMazatlan(value: 'america/mazatlan'), - americaMenominee(value: 'america/menominee'), - americaMerida(value: 'america/merida'), - americaMetlakatla(value: 'america/metlakatla'), - americaMexicoCity(value: 'america/mexico_city'), - americaMiquelon(value: 'america/miquelon'), - americaMoncton(value: 'america/moncton'), - americaMonterrey(value: 'america/monterrey'), - americaMontevideo(value: 'america/montevideo'), - americaMontserrat(value: 'america/montserrat'), - americaNassau(value: 'america/nassau'), - americaNewYork(value: 'america/new_york'), - americaNome(value: 'america/nome'), - americaNoronha(value: 'america/noronha'), - americaNorthDakotaBeulah(value: 'america/north_dakota/beulah'), - americaNorthDakotaCenter(value: 'america/north_dakota/center'), - americaNorthDakotaNewSalem(value: 'america/north_dakota/new_salem'), - americaNuuk(value: 'america/nuuk'), - americaOjinaga(value: 'america/ojinaga'), - americaPanama(value: 'america/panama'), - americaParamaribo(value: 'america/paramaribo'), - americaPhoenix(value: 'america/phoenix'), - americaPortAuPrince(value: 'america/port-au-prince'), - americaPortOfSpain(value: 'america/port_of_spain'), - americaPortoVelho(value: 'america/porto_velho'), - americaPuertoRico(value: 'america/puerto_rico'), - americaPuntaArenas(value: 'america/punta_arenas'), - americaRankinInlet(value: 'america/rankin_inlet'), - americaRecife(value: 'america/recife'), - americaRegina(value: 'america/regina'), - americaResolute(value: 'america/resolute'), - americaRioBranco(value: 'america/rio_branco'), - americaSantarem(value: 'america/santarem'), - americaSantiago(value: 'america/santiago'), - americaSantoDomingo(value: 'america/santo_domingo'), - americaSaoPaulo(value: 'america/sao_paulo'), - americaScoresbysund(value: 'america/scoresbysund'), - americaSitka(value: 'america/sitka'), - americaStBarthelemy(value: 'america/st_barthelemy'), - americaStJohns(value: 'america/st_johns'), - americaStKitts(value: 'america/st_kitts'), - americaStLucia(value: 'america/st_lucia'), - americaStThomas(value: 'america/st_thomas'), - americaStVincent(value: 'america/st_vincent'), - americaSwiftCurrent(value: 'america/swift_current'), - americaTegucigalpa(value: 'america/tegucigalpa'), - americaThule(value: 'america/thule'), - americaTijuana(value: 'america/tijuana'), - americaToronto(value: 'america/toronto'), - americaTortola(value: 'america/tortola'), - americaVancouver(value: 'america/vancouver'), - americaWhitehorse(value: 'america/whitehorse'), - americaWinnipeg(value: 'america/winnipeg'), - americaYakutat(value: 'america/yakutat'), - antarcticaCasey(value: 'antarctica/casey'), - antarcticaDavis(value: 'antarctica/davis'), - antarcticaDumontdurville(value: 'antarctica/dumontdurville'), - antarcticaMacquarie(value: 'antarctica/macquarie'), - antarcticaMawson(value: 'antarctica/mawson'), - antarcticaMcmurdo(value: 'antarctica/mcmurdo'), - antarcticaPalmer(value: 'antarctica/palmer'), - antarcticaRothera(value: 'antarctica/rothera'), - antarcticaSyowa(value: 'antarctica/syowa'), - antarcticaTroll(value: 'antarctica/troll'), - antarcticaVostok(value: 'antarctica/vostok'), - arcticLongyearbyen(value: 'arctic/longyearbyen'), - asiaAden(value: 'asia/aden'), - asiaAlmaty(value: 'asia/almaty'), - asiaAmman(value: 'asia/amman'), - asiaAnadyr(value: 'asia/anadyr'), - asiaAqtau(value: 'asia/aqtau'), - asiaAqtobe(value: 'asia/aqtobe'), - asiaAshgabat(value: 'asia/ashgabat'), - asiaAtyrau(value: 'asia/atyrau'), - asiaBaghdad(value: 'asia/baghdad'), - asiaBahrain(value: 'asia/bahrain'), - asiaBaku(value: 'asia/baku'), - asiaBangkok(value: 'asia/bangkok'), - asiaBarnaul(value: 'asia/barnaul'), - asiaBeirut(value: 'asia/beirut'), - asiaBishkek(value: 'asia/bishkek'), - asiaBrunei(value: 'asia/brunei'), - asiaChita(value: 'asia/chita'), - asiaColombo(value: 'asia/colombo'), - asiaDamascus(value: 'asia/damascus'), - asiaDhaka(value: 'asia/dhaka'), - asiaDili(value: 'asia/dili'), - asiaDubai(value: 'asia/dubai'), - asiaDushanbe(value: 'asia/dushanbe'), - asiaFamagusta(value: 'asia/famagusta'), - asiaGaza(value: 'asia/gaza'), - asiaHebron(value: 'asia/hebron'), - asiaHoChiMinh(value: 'asia/ho_chi_minh'), - asiaHongKong(value: 'asia/hong_kong'), - asiaHovd(value: 'asia/hovd'), - asiaIrkutsk(value: 'asia/irkutsk'), - asiaJakarta(value: 'asia/jakarta'), - asiaJayapura(value: 'asia/jayapura'), - asiaJerusalem(value: 'asia/jerusalem'), - asiaKabul(value: 'asia/kabul'), - asiaKamchatka(value: 'asia/kamchatka'), - asiaKarachi(value: 'asia/karachi'), - asiaKathmandu(value: 'asia/kathmandu'), - asiaKhandyga(value: 'asia/khandyga'), - asiaKolkata(value: 'asia/kolkata'), - asiaKrasnoyarsk(value: 'asia/krasnoyarsk'), - asiaKualaLumpur(value: 'asia/kuala_lumpur'), - asiaKuching(value: 'asia/kuching'), - asiaKuwait(value: 'asia/kuwait'), - asiaMacau(value: 'asia/macau'), - asiaMagadan(value: 'asia/magadan'), - asiaMakassar(value: 'asia/makassar'), - asiaManila(value: 'asia/manila'), - asiaMuscat(value: 'asia/muscat'), - asiaNicosia(value: 'asia/nicosia'), - asiaNovokuznetsk(value: 'asia/novokuznetsk'), - asiaNovosibirsk(value: 'asia/novosibirsk'), - asiaOmsk(value: 'asia/omsk'), - asiaOral(value: 'asia/oral'), - asiaPhnomPenh(value: 'asia/phnom_penh'), - asiaPontianak(value: 'asia/pontianak'), - asiaPyongyang(value: 'asia/pyongyang'), - asiaQatar(value: 'asia/qatar'), - asiaQostanay(value: 'asia/qostanay'), - asiaQyzylorda(value: 'asia/qyzylorda'), - asiaRiyadh(value: 'asia/riyadh'), - asiaSakhalin(value: 'asia/sakhalin'), - asiaSamarkand(value: 'asia/samarkand'), - asiaSeoul(value: 'asia/seoul'), - asiaShanghai(value: 'asia/shanghai'), - asiaSingapore(value: 'asia/singapore'), - asiaSrednekolymsk(value: 'asia/srednekolymsk'), - asiaTaipei(value: 'asia/taipei'), - asiaTashkent(value: 'asia/tashkent'), - asiaTbilisi(value: 'asia/tbilisi'), - asiaTehran(value: 'asia/tehran'), - asiaThimphu(value: 'asia/thimphu'), - asiaTokyo(value: 'asia/tokyo'), - asiaTomsk(value: 'asia/tomsk'), - asiaUlaanbaatar(value: 'asia/ulaanbaatar'), - asiaUrumqi(value: 'asia/urumqi'), - asiaUstNera(value: 'asia/ust-nera'), - asiaVientiane(value: 'asia/vientiane'), - asiaVladivostok(value: 'asia/vladivostok'), - asiaYakutsk(value: 'asia/yakutsk'), - asiaYangon(value: 'asia/yangon'), - asiaYekaterinburg(value: 'asia/yekaterinburg'), - asiaYerevan(value: 'asia/yerevan'), - atlanticAzores(value: 'atlantic/azores'), - atlanticBermuda(value: 'atlantic/bermuda'), - atlanticCanary(value: 'atlantic/canary'), - atlanticCapeVerde(value: 'atlantic/cape_verde'), - atlanticFaroe(value: 'atlantic/faroe'), - atlanticMadeira(value: 'atlantic/madeira'), - atlanticReykjavik(value: 'atlantic/reykjavik'), - atlanticSouthGeorgia(value: 'atlantic/south_georgia'), - atlanticStHelena(value: 'atlantic/st_helena'), - atlanticStanley(value: 'atlantic/stanley'), - australiaAdelaide(value: 'australia/adelaide'), - australiaBrisbane(value: 'australia/brisbane'), - australiaBrokenHill(value: 'australia/broken_hill'), - australiaDarwin(value: 'australia/darwin'), - australiaEucla(value: 'australia/eucla'), - australiaHobart(value: 'australia/hobart'), - australiaLindeman(value: 'australia/lindeman'), - australiaLordHowe(value: 'australia/lord_howe'), - australiaMelbourne(value: 'australia/melbourne'), - australiaPerth(value: 'australia/perth'), - australiaSydney(value: 'australia/sydney'), - europeAmsterdam(value: 'europe/amsterdam'), - europeAndorra(value: 'europe/andorra'), - europeAstrakhan(value: 'europe/astrakhan'), - europeAthens(value: 'europe/athens'), - europeBelgrade(value: 'europe/belgrade'), - europeBerlin(value: 'europe/berlin'), - europeBratislava(value: 'europe/bratislava'), - europeBrussels(value: 'europe/brussels'), - europeBucharest(value: 'europe/bucharest'), - europeBudapest(value: 'europe/budapest'), - europeBusingen(value: 'europe/busingen'), - europeChisinau(value: 'europe/chisinau'), - europeCopenhagen(value: 'europe/copenhagen'), - europeDublin(value: 'europe/dublin'), - europeGibraltar(value: 'europe/gibraltar'), - europeGuernsey(value: 'europe/guernsey'), - europeHelsinki(value: 'europe/helsinki'), - europeIsleOfMan(value: 'europe/isle_of_man'), - europeIstanbul(value: 'europe/istanbul'), - europeJersey(value: 'europe/jersey'), - europeKaliningrad(value: 'europe/kaliningrad'), - europeKirov(value: 'europe/kirov'), - europeKyiv(value: 'europe/kyiv'), - europeLisbon(value: 'europe/lisbon'), - europeLjubljana(value: 'europe/ljubljana'), - europeLondon(value: 'europe/london'), - europeLuxembourg(value: 'europe/luxembourg'), - europeMadrid(value: 'europe/madrid'), - europeMalta(value: 'europe/malta'), - europeMariehamn(value: 'europe/mariehamn'), - europeMinsk(value: 'europe/minsk'), - europeMonaco(value: 'europe/monaco'), - europeMoscow(value: 'europe/moscow'), - europeOslo(value: 'europe/oslo'), - europeParis(value: 'europe/paris'), - europePodgorica(value: 'europe/podgorica'), - europePrague(value: 'europe/prague'), - europeRiga(value: 'europe/riga'), - europeRome(value: 'europe/rome'), - europeSamara(value: 'europe/samara'), - europeSanMarino(value: 'europe/san_marino'), - europeSarajevo(value: 'europe/sarajevo'), - europeSaratov(value: 'europe/saratov'), - europeSimferopol(value: 'europe/simferopol'), - europeSkopje(value: 'europe/skopje'), - europeSofia(value: 'europe/sofia'), - europeStockholm(value: 'europe/stockholm'), - europeTallinn(value: 'europe/tallinn'), - europeTirane(value: 'europe/tirane'), - europeUlyanovsk(value: 'europe/ulyanovsk'), - europeVaduz(value: 'europe/vaduz'), - europeVatican(value: 'europe/vatican'), - europeVienna(value: 'europe/vienna'), - europeVilnius(value: 'europe/vilnius'), - europeVolgograd(value: 'europe/volgograd'), - europeWarsaw(value: 'europe/warsaw'), - europeZagreb(value: 'europe/zagreb'), - europeZurich(value: 'europe/zurich'), - indianAntananarivo(value: 'indian/antananarivo'), - indianChagos(value: 'indian/chagos'), - indianChristmas(value: 'indian/christmas'), - indianCocos(value: 'indian/cocos'), - indianComoro(value: 'indian/comoro'), - indianKerguelen(value: 'indian/kerguelen'), - indianMahe(value: 'indian/mahe'), - indianMaldives(value: 'indian/maldives'), - indianMauritius(value: 'indian/mauritius'), - indianMayotte(value: 'indian/mayotte'), - indianReunion(value: 'indian/reunion'), - pacificApia(value: 'pacific/apia'), - pacificAuckland(value: 'pacific/auckland'), - pacificBougainville(value: 'pacific/bougainville'), - pacificChatham(value: 'pacific/chatham'), - pacificChuuk(value: 'pacific/chuuk'), - pacificEaster(value: 'pacific/easter'), - pacificEfate(value: 'pacific/efate'), - pacificFakaofo(value: 'pacific/fakaofo'), - pacificFiji(value: 'pacific/fiji'), - pacificFunafuti(value: 'pacific/funafuti'), - pacificGalapagos(value: 'pacific/galapagos'), - pacificGambier(value: 'pacific/gambier'), - pacificGuadalcanal(value: 'pacific/guadalcanal'), - pacificGuam(value: 'pacific/guam'), - pacificHonolulu(value: 'pacific/honolulu'), - pacificKanton(value: 'pacific/kanton'), - pacificKiritimati(value: 'pacific/kiritimati'), - pacificKosrae(value: 'pacific/kosrae'), - pacificKwajalein(value: 'pacific/kwajalein'), - pacificMajuro(value: 'pacific/majuro'), - pacificMarquesas(value: 'pacific/marquesas'), - pacificMidway(value: 'pacific/midway'), - pacificNauru(value: 'pacific/nauru'), - pacificNiue(value: 'pacific/niue'), - pacificNorfolk(value: 'pacific/norfolk'), - pacificNoumea(value: 'pacific/noumea'), - pacificPagoPago(value: 'pacific/pago_pago'), - pacificPalau(value: 'pacific/palau'), - pacificPitcairn(value: 'pacific/pitcairn'), - pacificPohnpei(value: 'pacific/pohnpei'), - pacificPortMoresby(value: 'pacific/port_moresby'), - pacificRarotonga(value: 'pacific/rarotonga'), - pacificSaipan(value: 'pacific/saipan'), - pacificTahiti(value: 'pacific/tahiti'), - pacificTarawa(value: 'pacific/tarawa'), - pacificTongatapu(value: 'pacific/tongatapu'), - pacificWake(value: 'pacific/wake'), - pacificWallis(value: 'pacific/wallis'), - utc(value: 'utc'); + africaAbidjan(value: 'africa/abidjan'), + africaAccra(value: 'africa/accra'), + africaAddisAbaba(value: 'africa/addis_ababa'), + africaAlgiers(value: 'africa/algiers'), + africaAsmara(value: 'africa/asmara'), + africaBamako(value: 'africa/bamako'), + africaBangui(value: 'africa/bangui'), + africaBanjul(value: 'africa/banjul'), + africaBissau(value: 'africa/bissau'), + africaBlantyre(value: 'africa/blantyre'), + africaBrazzaville(value: 'africa/brazzaville'), + africaBujumbura(value: 'africa/bujumbura'), + africaCairo(value: 'africa/cairo'), + africaCasablanca(value: 'africa/casablanca'), + africaCeuta(value: 'africa/ceuta'), + africaConakry(value: 'africa/conakry'), + africaDakar(value: 'africa/dakar'), + africaDarEsSalaam(value: 'africa/dar_es_salaam'), + africaDjibouti(value: 'africa/djibouti'), + africaDouala(value: 'africa/douala'), + africaElAaiun(value: 'africa/el_aaiun'), + africaFreetown(value: 'africa/freetown'), + africaGaborone(value: 'africa/gaborone'), + africaHarare(value: 'africa/harare'), + africaJohannesburg(value: 'africa/johannesburg'), + africaJuba(value: 'africa/juba'), + africaKampala(value: 'africa/kampala'), + africaKhartoum(value: 'africa/khartoum'), + africaKigali(value: 'africa/kigali'), + africaKinshasa(value: 'africa/kinshasa'), + africaLagos(value: 'africa/lagos'), + africaLibreville(value: 'africa/libreville'), + africaLome(value: 'africa/lome'), + africaLuanda(value: 'africa/luanda'), + africaLubumbashi(value: 'africa/lubumbashi'), + africaLusaka(value: 'africa/lusaka'), + africaMalabo(value: 'africa/malabo'), + africaMaputo(value: 'africa/maputo'), + africaMaseru(value: 'africa/maseru'), + africaMbabane(value: 'africa/mbabane'), + africaMogadishu(value: 'africa/mogadishu'), + africaMonrovia(value: 'africa/monrovia'), + africaNairobi(value: 'africa/nairobi'), + africaNdjamena(value: 'africa/ndjamena'), + africaNiamey(value: 'africa/niamey'), + africaNouakchott(value: 'africa/nouakchott'), + africaOuagadougou(value: 'africa/ouagadougou'), + africaPortoNovo(value: 'africa/porto-novo'), + africaSaoTome(value: 'africa/sao_tome'), + africaTripoli(value: 'africa/tripoli'), + africaTunis(value: 'africa/tunis'), + africaWindhoek(value: 'africa/windhoek'), + americaAdak(value: 'america/adak'), + americaAnchorage(value: 'america/anchorage'), + americaAnguilla(value: 'america/anguilla'), + americaAntigua(value: 'america/antigua'), + americaAraguaina(value: 'america/araguaina'), + americaArgentinaBuenosAires(value: 'america/argentina/buenos_aires'), + americaArgentinaCatamarca(value: 'america/argentina/catamarca'), + americaArgentinaCordoba(value: 'america/argentina/cordoba'), + americaArgentinaJujuy(value: 'america/argentina/jujuy'), + americaArgentinaLaRioja(value: 'america/argentina/la_rioja'), + americaArgentinaMendoza(value: 'america/argentina/mendoza'), + americaArgentinaRioGallegos(value: 'america/argentina/rio_gallegos'), + americaArgentinaSalta(value: 'america/argentina/salta'), + americaArgentinaSanJuan(value: 'america/argentina/san_juan'), + americaArgentinaSanLuis(value: 'america/argentina/san_luis'), + americaArgentinaTucuman(value: 'america/argentina/tucuman'), + americaArgentinaUshuaia(value: 'america/argentina/ushuaia'), + americaAruba(value: 'america/aruba'), + americaAsuncion(value: 'america/asuncion'), + americaAtikokan(value: 'america/atikokan'), + americaBahia(value: 'america/bahia'), + americaBahiaBanderas(value: 'america/bahia_banderas'), + americaBarbados(value: 'america/barbados'), + americaBelem(value: 'america/belem'), + americaBelize(value: 'america/belize'), + americaBlancSablon(value: 'america/blanc-sablon'), + americaBoaVista(value: 'america/boa_vista'), + americaBogota(value: 'america/bogota'), + americaBoise(value: 'america/boise'), + americaCambridgeBay(value: 'america/cambridge_bay'), + americaCampoGrande(value: 'america/campo_grande'), + americaCancun(value: 'america/cancun'), + americaCaracas(value: 'america/caracas'), + americaCayenne(value: 'america/cayenne'), + americaCayman(value: 'america/cayman'), + americaChicago(value: 'america/chicago'), + americaChihuahua(value: 'america/chihuahua'), + americaCiudadJuarez(value: 'america/ciudad_juarez'), + americaCostaRica(value: 'america/costa_rica'), + americaCoyhaique(value: 'america/coyhaique'), + americaCreston(value: 'america/creston'), + americaCuiaba(value: 'america/cuiaba'), + americaCuracao(value: 'america/curacao'), + americaDanmarkshavn(value: 'america/danmarkshavn'), + americaDawson(value: 'america/dawson'), + americaDawsonCreek(value: 'america/dawson_creek'), + americaDenver(value: 'america/denver'), + americaDetroit(value: 'america/detroit'), + americaDominica(value: 'america/dominica'), + americaEdmonton(value: 'america/edmonton'), + americaEirunepe(value: 'america/eirunepe'), + americaElSalvador(value: 'america/el_salvador'), + americaFortNelson(value: 'america/fort_nelson'), + americaFortaleza(value: 'america/fortaleza'), + americaGlaceBay(value: 'america/glace_bay'), + americaGooseBay(value: 'america/goose_bay'), + americaGrandTurk(value: 'america/grand_turk'), + americaGrenada(value: 'america/grenada'), + americaGuadeloupe(value: 'america/guadeloupe'), + americaGuatemala(value: 'america/guatemala'), + americaGuayaquil(value: 'america/guayaquil'), + americaGuyana(value: 'america/guyana'), + americaHalifax(value: 'america/halifax'), + americaHavana(value: 'america/havana'), + americaHermosillo(value: 'america/hermosillo'), + americaIndianaIndianapolis(value: 'america/indiana/indianapolis'), + americaIndianaKnox(value: 'america/indiana/knox'), + americaIndianaMarengo(value: 'america/indiana/marengo'), + americaIndianaPetersburg(value: 'america/indiana/petersburg'), + americaIndianaTellCity(value: 'america/indiana/tell_city'), + americaIndianaVevay(value: 'america/indiana/vevay'), + americaIndianaVincennes(value: 'america/indiana/vincennes'), + americaIndianaWinamac(value: 'america/indiana/winamac'), + americaInuvik(value: 'america/inuvik'), + americaIqaluit(value: 'america/iqaluit'), + americaJamaica(value: 'america/jamaica'), + americaJuneau(value: 'america/juneau'), + americaKentuckyLouisville(value: 'america/kentucky/louisville'), + americaKentuckyMonticello(value: 'america/kentucky/monticello'), + americaKralendijk(value: 'america/kralendijk'), + americaLaPaz(value: 'america/la_paz'), + americaLima(value: 'america/lima'), + americaLosAngeles(value: 'america/los_angeles'), + americaLowerPrinces(value: 'america/lower_princes'), + americaMaceio(value: 'america/maceio'), + americaManagua(value: 'america/managua'), + americaManaus(value: 'america/manaus'), + americaMarigot(value: 'america/marigot'), + americaMartinique(value: 'america/martinique'), + americaMatamoros(value: 'america/matamoros'), + americaMazatlan(value: 'america/mazatlan'), + americaMenominee(value: 'america/menominee'), + americaMerida(value: 'america/merida'), + americaMetlakatla(value: 'america/metlakatla'), + americaMexicoCity(value: 'america/mexico_city'), + americaMiquelon(value: 'america/miquelon'), + americaMoncton(value: 'america/moncton'), + americaMonterrey(value: 'america/monterrey'), + americaMontevideo(value: 'america/montevideo'), + americaMontserrat(value: 'america/montserrat'), + americaNassau(value: 'america/nassau'), + americaNewYork(value: 'america/new_york'), + americaNome(value: 'america/nome'), + americaNoronha(value: 'america/noronha'), + americaNorthDakotaBeulah(value: 'america/north_dakota/beulah'), + americaNorthDakotaCenter(value: 'america/north_dakota/center'), + americaNorthDakotaNewSalem(value: 'america/north_dakota/new_salem'), + americaNuuk(value: 'america/nuuk'), + americaOjinaga(value: 'america/ojinaga'), + americaPanama(value: 'america/panama'), + americaParamaribo(value: 'america/paramaribo'), + americaPhoenix(value: 'america/phoenix'), + americaPortAuPrince(value: 'america/port-au-prince'), + americaPortOfSpain(value: 'america/port_of_spain'), + americaPortoVelho(value: 'america/porto_velho'), + americaPuertoRico(value: 'america/puerto_rico'), + americaPuntaArenas(value: 'america/punta_arenas'), + americaRankinInlet(value: 'america/rankin_inlet'), + americaRecife(value: 'america/recife'), + americaRegina(value: 'america/regina'), + americaResolute(value: 'america/resolute'), + americaRioBranco(value: 'america/rio_branco'), + americaSantarem(value: 'america/santarem'), + americaSantiago(value: 'america/santiago'), + americaSantoDomingo(value: 'america/santo_domingo'), + americaSaoPaulo(value: 'america/sao_paulo'), + americaScoresbysund(value: 'america/scoresbysund'), + americaSitka(value: 'america/sitka'), + americaStBarthelemy(value: 'america/st_barthelemy'), + americaStJohns(value: 'america/st_johns'), + americaStKitts(value: 'america/st_kitts'), + americaStLucia(value: 'america/st_lucia'), + americaStThomas(value: 'america/st_thomas'), + americaStVincent(value: 'america/st_vincent'), + americaSwiftCurrent(value: 'america/swift_current'), + americaTegucigalpa(value: 'america/tegucigalpa'), + americaThule(value: 'america/thule'), + americaTijuana(value: 'america/tijuana'), + americaToronto(value: 'america/toronto'), + americaTortola(value: 'america/tortola'), + americaVancouver(value: 'america/vancouver'), + americaWhitehorse(value: 'america/whitehorse'), + americaWinnipeg(value: 'america/winnipeg'), + americaYakutat(value: 'america/yakutat'), + antarcticaCasey(value: 'antarctica/casey'), + antarcticaDavis(value: 'antarctica/davis'), + antarcticaDumontdurville(value: 'antarctica/dumontdurville'), + antarcticaMacquarie(value: 'antarctica/macquarie'), + antarcticaMawson(value: 'antarctica/mawson'), + antarcticaMcmurdo(value: 'antarctica/mcmurdo'), + antarcticaPalmer(value: 'antarctica/palmer'), + antarcticaRothera(value: 'antarctica/rothera'), + antarcticaSyowa(value: 'antarctica/syowa'), + antarcticaTroll(value: 'antarctica/troll'), + antarcticaVostok(value: 'antarctica/vostok'), + arcticLongyearbyen(value: 'arctic/longyearbyen'), + asiaAden(value: 'asia/aden'), + asiaAlmaty(value: 'asia/almaty'), + asiaAmman(value: 'asia/amman'), + asiaAnadyr(value: 'asia/anadyr'), + asiaAqtau(value: 'asia/aqtau'), + asiaAqtobe(value: 'asia/aqtobe'), + asiaAshgabat(value: 'asia/ashgabat'), + asiaAtyrau(value: 'asia/atyrau'), + asiaBaghdad(value: 'asia/baghdad'), + asiaBahrain(value: 'asia/bahrain'), + asiaBaku(value: 'asia/baku'), + asiaBangkok(value: 'asia/bangkok'), + asiaBarnaul(value: 'asia/barnaul'), + asiaBeirut(value: 'asia/beirut'), + asiaBishkek(value: 'asia/bishkek'), + asiaBrunei(value: 'asia/brunei'), + asiaChita(value: 'asia/chita'), + asiaColombo(value: 'asia/colombo'), + asiaDamascus(value: 'asia/damascus'), + asiaDhaka(value: 'asia/dhaka'), + asiaDili(value: 'asia/dili'), + asiaDubai(value: 'asia/dubai'), + asiaDushanbe(value: 'asia/dushanbe'), + asiaFamagusta(value: 'asia/famagusta'), + asiaGaza(value: 'asia/gaza'), + asiaHebron(value: 'asia/hebron'), + asiaHoChiMinh(value: 'asia/ho_chi_minh'), + asiaHongKong(value: 'asia/hong_kong'), + asiaHovd(value: 'asia/hovd'), + asiaIrkutsk(value: 'asia/irkutsk'), + asiaJakarta(value: 'asia/jakarta'), + asiaJayapura(value: 'asia/jayapura'), + asiaJerusalem(value: 'asia/jerusalem'), + asiaKabul(value: 'asia/kabul'), + asiaKamchatka(value: 'asia/kamchatka'), + asiaKarachi(value: 'asia/karachi'), + asiaKathmandu(value: 'asia/kathmandu'), + asiaKhandyga(value: 'asia/khandyga'), + asiaKolkata(value: 'asia/kolkata'), + asiaKrasnoyarsk(value: 'asia/krasnoyarsk'), + asiaKualaLumpur(value: 'asia/kuala_lumpur'), + asiaKuching(value: 'asia/kuching'), + asiaKuwait(value: 'asia/kuwait'), + asiaMacau(value: 'asia/macau'), + asiaMagadan(value: 'asia/magadan'), + asiaMakassar(value: 'asia/makassar'), + asiaManila(value: 'asia/manila'), + asiaMuscat(value: 'asia/muscat'), + asiaNicosia(value: 'asia/nicosia'), + asiaNovokuznetsk(value: 'asia/novokuznetsk'), + asiaNovosibirsk(value: 'asia/novosibirsk'), + asiaOmsk(value: 'asia/omsk'), + asiaOral(value: 'asia/oral'), + asiaPhnomPenh(value: 'asia/phnom_penh'), + asiaPontianak(value: 'asia/pontianak'), + asiaPyongyang(value: 'asia/pyongyang'), + asiaQatar(value: 'asia/qatar'), + asiaQostanay(value: 'asia/qostanay'), + asiaQyzylorda(value: 'asia/qyzylorda'), + asiaRiyadh(value: 'asia/riyadh'), + asiaSakhalin(value: 'asia/sakhalin'), + asiaSamarkand(value: 'asia/samarkand'), + asiaSeoul(value: 'asia/seoul'), + asiaShanghai(value: 'asia/shanghai'), + asiaSingapore(value: 'asia/singapore'), + asiaSrednekolymsk(value: 'asia/srednekolymsk'), + asiaTaipei(value: 'asia/taipei'), + asiaTashkent(value: 'asia/tashkent'), + asiaTbilisi(value: 'asia/tbilisi'), + asiaTehran(value: 'asia/tehran'), + asiaThimphu(value: 'asia/thimphu'), + asiaTokyo(value: 'asia/tokyo'), + asiaTomsk(value: 'asia/tomsk'), + asiaUlaanbaatar(value: 'asia/ulaanbaatar'), + asiaUrumqi(value: 'asia/urumqi'), + asiaUstNera(value: 'asia/ust-nera'), + asiaVientiane(value: 'asia/vientiane'), + asiaVladivostok(value: 'asia/vladivostok'), + asiaYakutsk(value: 'asia/yakutsk'), + asiaYangon(value: 'asia/yangon'), + asiaYekaterinburg(value: 'asia/yekaterinburg'), + asiaYerevan(value: 'asia/yerevan'), + atlanticAzores(value: 'atlantic/azores'), + atlanticBermuda(value: 'atlantic/bermuda'), + atlanticCanary(value: 'atlantic/canary'), + atlanticCapeVerde(value: 'atlantic/cape_verde'), + atlanticFaroe(value: 'atlantic/faroe'), + atlanticMadeira(value: 'atlantic/madeira'), + atlanticReykjavik(value: 'atlantic/reykjavik'), + atlanticSouthGeorgia(value: 'atlantic/south_georgia'), + atlanticStHelena(value: 'atlantic/st_helena'), + atlanticStanley(value: 'atlantic/stanley'), + australiaAdelaide(value: 'australia/adelaide'), + australiaBrisbane(value: 'australia/brisbane'), + australiaBrokenHill(value: 'australia/broken_hill'), + australiaDarwin(value: 'australia/darwin'), + australiaEucla(value: 'australia/eucla'), + australiaHobart(value: 'australia/hobart'), + australiaLindeman(value: 'australia/lindeman'), + australiaLordHowe(value: 'australia/lord_howe'), + australiaMelbourne(value: 'australia/melbourne'), + australiaPerth(value: 'australia/perth'), + australiaSydney(value: 'australia/sydney'), + europeAmsterdam(value: 'europe/amsterdam'), + europeAndorra(value: 'europe/andorra'), + europeAstrakhan(value: 'europe/astrakhan'), + europeAthens(value: 'europe/athens'), + europeBelgrade(value: 'europe/belgrade'), + europeBerlin(value: 'europe/berlin'), + europeBratislava(value: 'europe/bratislava'), + europeBrussels(value: 'europe/brussels'), + europeBucharest(value: 'europe/bucharest'), + europeBudapest(value: 'europe/budapest'), + europeBusingen(value: 'europe/busingen'), + europeChisinau(value: 'europe/chisinau'), + europeCopenhagen(value: 'europe/copenhagen'), + europeDublin(value: 'europe/dublin'), + europeGibraltar(value: 'europe/gibraltar'), + europeGuernsey(value: 'europe/guernsey'), + europeHelsinki(value: 'europe/helsinki'), + europeIsleOfMan(value: 'europe/isle_of_man'), + europeIstanbul(value: 'europe/istanbul'), + europeJersey(value: 'europe/jersey'), + europeKaliningrad(value: 'europe/kaliningrad'), + europeKirov(value: 'europe/kirov'), + europeKyiv(value: 'europe/kyiv'), + europeLisbon(value: 'europe/lisbon'), + europeLjubljana(value: 'europe/ljubljana'), + europeLondon(value: 'europe/london'), + europeLuxembourg(value: 'europe/luxembourg'), + europeMadrid(value: 'europe/madrid'), + europeMalta(value: 'europe/malta'), + europeMariehamn(value: 'europe/mariehamn'), + europeMinsk(value: 'europe/minsk'), + europeMonaco(value: 'europe/monaco'), + europeMoscow(value: 'europe/moscow'), + europeOslo(value: 'europe/oslo'), + europeParis(value: 'europe/paris'), + europePodgorica(value: 'europe/podgorica'), + europePrague(value: 'europe/prague'), + europeRiga(value: 'europe/riga'), + europeRome(value: 'europe/rome'), + europeSamara(value: 'europe/samara'), + europeSanMarino(value: 'europe/san_marino'), + europeSarajevo(value: 'europe/sarajevo'), + europeSaratov(value: 'europe/saratov'), + europeSimferopol(value: 'europe/simferopol'), + europeSkopje(value: 'europe/skopje'), + europeSofia(value: 'europe/sofia'), + europeStockholm(value: 'europe/stockholm'), + europeTallinn(value: 'europe/tallinn'), + europeTirane(value: 'europe/tirane'), + europeUlyanovsk(value: 'europe/ulyanovsk'), + europeVaduz(value: 'europe/vaduz'), + europeVatican(value: 'europe/vatican'), + europeVienna(value: 'europe/vienna'), + europeVilnius(value: 'europe/vilnius'), + europeVolgograd(value: 'europe/volgograd'), + europeWarsaw(value: 'europe/warsaw'), + europeZagreb(value: 'europe/zagreb'), + europeZurich(value: 'europe/zurich'), + indianAntananarivo(value: 'indian/antananarivo'), + indianChagos(value: 'indian/chagos'), + indianChristmas(value: 'indian/christmas'), + indianCocos(value: 'indian/cocos'), + indianComoro(value: 'indian/comoro'), + indianKerguelen(value: 'indian/kerguelen'), + indianMahe(value: 'indian/mahe'), + indianMaldives(value: 'indian/maldives'), + indianMauritius(value: 'indian/mauritius'), + indianMayotte(value: 'indian/mayotte'), + indianReunion(value: 'indian/reunion'), + pacificApia(value: 'pacific/apia'), + pacificAuckland(value: 'pacific/auckland'), + pacificBougainville(value: 'pacific/bougainville'), + pacificChatham(value: 'pacific/chatham'), + pacificChuuk(value: 'pacific/chuuk'), + pacificEaster(value: 'pacific/easter'), + pacificEfate(value: 'pacific/efate'), + pacificFakaofo(value: 'pacific/fakaofo'), + pacificFiji(value: 'pacific/fiji'), + pacificFunafuti(value: 'pacific/funafuti'), + pacificGalapagos(value: 'pacific/galapagos'), + pacificGambier(value: 'pacific/gambier'), + pacificGuadalcanal(value: 'pacific/guadalcanal'), + pacificGuam(value: 'pacific/guam'), + pacificHonolulu(value: 'pacific/honolulu'), + pacificKanton(value: 'pacific/kanton'), + pacificKiritimati(value: 'pacific/kiritimati'), + pacificKosrae(value: 'pacific/kosrae'), + pacificKwajalein(value: 'pacific/kwajalein'), + pacificMajuro(value: 'pacific/majuro'), + pacificMarquesas(value: 'pacific/marquesas'), + pacificMidway(value: 'pacific/midway'), + pacificNauru(value: 'pacific/nauru'), + pacificNiue(value: 'pacific/niue'), + pacificNorfolk(value: 'pacific/norfolk'), + pacificNoumea(value: 'pacific/noumea'), + pacificPagoPago(value: 'pacific/pago_pago'), + pacificPalau(value: 'pacific/palau'), + pacificPitcairn(value: 'pacific/pitcairn'), + pacificPohnpei(value: 'pacific/pohnpei'), + pacificPortMoresby(value: 'pacific/port_moresby'), + pacificRarotonga(value: 'pacific/rarotonga'), + pacificSaipan(value: 'pacific/saipan'), + pacificTahiti(value: 'pacific/tahiti'), + pacificTarawa(value: 'pacific/tarawa'), + pacificTongatapu(value: 'pacific/tongatapu'), + pacificWake(value: 'pacific/wake'), + pacificWallis(value: 'pacific/wallis'), + utc(value: 'utc'); - const Timezone({ - required this.value - }); + const Timezone({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/enums/vcs_reference_type.dart b/lib/src/enums/vcs_reference_type.dart index ae726469..c7e72f1c 100644 --- a/lib/src/enums/vcs_reference_type.dart +++ b/lib/src/enums/vcs_reference_type.dart @@ -1,15 +1,13 @@ part of '../../enums.dart'; enum VCSReferenceType { - branch(value: 'branch'), - commit(value: 'commit'), - tag(value: 'tag'); + branch(value: 'branch'), + commit(value: 'commit'), + tag(value: 'tag'); - const VCSReferenceType({ - required this.value - }); + const VCSReferenceType({required this.value}); - final String value; + final String value; - String toJson() => value; -} \ No newline at end of file + String toJson() => value; +} diff --git a/lib/src/exception.dart b/lib/src/exception.dart index 93b6ee3d..82229daa 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -13,7 +13,7 @@ class AppwriteException implements Exception { /// Initializes an Appwrite Exception. AppwriteException([this.message = "", this.code, this.type, this.response]); - + /// Returns the error type, message, and code. @override String toString() { diff --git a/lib/src/models/activity_event.dart b/lib/src/models/activity_event.dart index aba4fd22..107f492c 100644 --- a/lib/src/models/activity_event.dart +++ b/lib/src/models/activity_event.dart @@ -2,209 +2,209 @@ part of '../../models.dart'; /// ActivityEvent class ActivityEvent implements Model { - /// Event ID. - final String $id; + /// Event ID. + final String $id; - /// User type. - final String userType; + /// User type. + final String userType; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// User Email. - final String userEmail; + /// User Email. + final String userEmail; - /// User Name. - final String userName; + /// User Name. + final String userName; - /// Resource parent. - final String resourceParent; + /// Resource parent. + final String resourceParent; - /// Resource type. - final String resourceType; + /// Resource type. + final String resourceType; - /// Resource ID. - final String resourceId; + /// Resource ID. + final String resourceId; - /// Resource. - final String resource; + /// Resource. + final String resource; - /// Event name. - final String event; + /// Event name. + final String event; - /// User agent. - final String userAgent; + /// User agent. + final String userAgent; - /// IP address. - final String ip; - - /// API mode when event triggered. - final String mode; - - /// Location. - final String country; - - /// Log creation date in ISO 8601 format. - final String time; - - /// Project ID. - final String projectId; - - /// Team ID. - final String teamId; - - /// Hostname. - final String hostname; - - /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - final String osCode; - - /// Operating system name. - final String osName; - - /// Operating system version. - final String osVersion; - - /// Client type. - final String clientType; - - /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - final String clientCode; - - /// Client name. - final String clientName; - - /// Client version. - final String clientVersion; - - /// Client engine name. - final String clientEngine; - - /// Client engine name. - final String clientEngineVersion; - - /// Device name. - final String deviceName; - - /// Device brand name. - final String deviceBrand; - - /// Device model name. - final String deviceModel; - - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; - - /// Country name. - final String countryName; - - ActivityEvent({ - required this.$id, - required this.userType, - required this.userId, - required this.userEmail, - required this.userName, - required this.resourceParent, - required this.resourceType, - required this.resourceId, - required this.resource, - required this.event, - required this.userAgent, - required this.ip, - required this.mode, - required this.country, - required this.time, - required this.projectId, - required this.teamId, - required this.hostname, - required this.osCode, - required this.osName, - required this.osVersion, - required this.clientType, - required this.clientCode, - required this.clientName, - required this.clientVersion, - required this.clientEngine, - required this.clientEngineVersion, - required this.deviceName, - required this.deviceBrand, - required this.deviceModel, - required this.countryCode, - required this.countryName, - }); - - factory ActivityEvent.fromMap(Map map) { - return ActivityEvent( - $id: map['\$id'].toString(), - userType: map['userType'].toString(), - userId: map['userId'].toString(), - userEmail: map['userEmail'].toString(), - userName: map['userName'].toString(), - resourceParent: map['resourceParent'].toString(), - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - resource: map['resource'].toString(), - event: map['event'].toString(), - userAgent: map['userAgent'].toString(), - ip: map['ip'].toString(), - mode: map['mode'].toString(), - country: map['country'].toString(), - time: map['time'].toString(), - projectId: map['projectId'].toString(), - teamId: map['teamId'].toString(), - hostname: map['hostname'].toString(), - osCode: map['osCode'].toString(), - osName: map['osName'].toString(), - osVersion: map['osVersion'].toString(), - clientType: map['clientType'].toString(), - clientCode: map['clientCode'].toString(), - clientName: map['clientName'].toString(), - clientVersion: map['clientVersion'].toString(), - clientEngine: map['clientEngine'].toString(), - clientEngineVersion: map['clientEngineVersion'].toString(), - deviceName: map['deviceName'].toString(), - deviceBrand: map['deviceBrand'].toString(), - deviceModel: map['deviceModel'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "userType": userType, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "resourceParent": resourceParent, - "resourceType": resourceType, - "resourceId": resourceId, - "resource": resource, - "event": event, - "userAgent": userAgent, - "ip": ip, - "mode": mode, - "country": country, - "time": time, - "projectId": projectId, - "teamId": teamId, - "hostname": hostname, - "osCode": osCode, - "osName": osName, - "osVersion": osVersion, - "clientType": clientType, - "clientCode": clientCode, - "clientName": clientName, - "clientVersion": clientVersion, - "clientEngine": clientEngine, - "clientEngineVersion": clientEngineVersion, - "deviceName": deviceName, - "deviceBrand": deviceBrand, - "deviceModel": deviceModel, - "countryCode": countryCode, - "countryName": countryName, - }; - } + /// IP address. + final String ip; + + /// API mode when event triggered. + final String mode; + + /// Location. + final String country; + + /// Log creation date in ISO 8601 format. + final String time; + + /// Project ID. + final String projectId; + + /// Team ID. + final String teamId; + + /// Hostname. + final String hostname; + + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + final String osCode; + + /// Operating system name. + final String osName; + + /// Operating system version. + final String osVersion; + + /// Client type. + final String clientType; + + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + final String clientCode; + + /// Client name. + final String clientName; + + /// Client version. + final String clientVersion; + + /// Client engine name. + final String clientEngine; + + /// Client engine name. + final String clientEngineVersion; + + /// Device name. + final String deviceName; + + /// Device brand name. + final String deviceBrand; + + /// Device model name. + final String deviceModel; + + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; + + /// Country name. + final String countryName; + + ActivityEvent({ + required this.$id, + required this.userType, + required this.userId, + required this.userEmail, + required this.userName, + required this.resourceParent, + required this.resourceType, + required this.resourceId, + required this.resource, + required this.event, + required this.userAgent, + required this.ip, + required this.mode, + required this.country, + required this.time, + required this.projectId, + required this.teamId, + required this.hostname, + required this.osCode, + required this.osName, + required this.osVersion, + required this.clientType, + required this.clientCode, + required this.clientName, + required this.clientVersion, + required this.clientEngine, + required this.clientEngineVersion, + required this.deviceName, + required this.deviceBrand, + required this.deviceModel, + required this.countryCode, + required this.countryName, + }); + + factory ActivityEvent.fromMap(Map map) { + return ActivityEvent( + $id: map['\$id'].toString(), + userType: map['userType'].toString(), + userId: map['userId'].toString(), + userEmail: map['userEmail'].toString(), + userName: map['userName'].toString(), + resourceParent: map['resourceParent'].toString(), + resourceType: map['resourceType'].toString(), + resourceId: map['resourceId'].toString(), + resource: map['resource'].toString(), + event: map['event'].toString(), + userAgent: map['userAgent'].toString(), + ip: map['ip'].toString(), + mode: map['mode'].toString(), + country: map['country'].toString(), + time: map['time'].toString(), + projectId: map['projectId'].toString(), + teamId: map['teamId'].toString(), + hostname: map['hostname'].toString(), + osCode: map['osCode'].toString(), + osName: map['osName'].toString(), + osVersion: map['osVersion'].toString(), + clientType: map['clientType'].toString(), + clientCode: map['clientCode'].toString(), + clientName: map['clientName'].toString(), + clientVersion: map['clientVersion'].toString(), + clientEngine: map['clientEngine'].toString(), + clientEngineVersion: map['clientEngineVersion'].toString(), + deviceName: map['deviceName'].toString(), + deviceBrand: map['deviceBrand'].toString(), + deviceModel: map['deviceModel'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "userType": userType, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "resourceParent": resourceParent, + "resourceType": resourceType, + "resourceId": resourceId, + "resource": resource, + "event": event, + "userAgent": userAgent, + "ip": ip, + "mode": mode, + "country": country, + "time": time, + "projectId": projectId, + "teamId": teamId, + "hostname": hostname, + "osCode": osCode, + "osName": osName, + "osVersion": osVersion, + "clientType": clientType, + "clientCode": clientCode, + "clientName": clientName, + "clientVersion": clientVersion, + "clientEngine": clientEngine, + "clientEngineVersion": clientEngineVersion, + "deviceName": deviceName, + "deviceBrand": deviceBrand, + "deviceModel": deviceModel, + "countryCode": countryCode, + "countryName": countryName, + }; + } } diff --git a/lib/src/models/activity_event_list.dart b/lib/src/models/activity_event_list.dart index d7637024..1825f531 100644 --- a/lib/src/models/activity_event_list.dart +++ b/lib/src/models/activity_event_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Activity event list class ActivityEventList implements Model { - /// Total number of events that matched your query. - final int total; + /// Total number of events that matched your query. + final int total; - /// List of events. - final List events; + /// List of events. + final List events; - ActivityEventList({ - required this.total, - required this.events, - }); + ActivityEventList({ + required this.total, + required this.events, + }); - factory ActivityEventList.fromMap(Map map) { - return ActivityEventList( - total: map['total'], - events: List.from(map['events'].map((p) => ActivityEvent.fromMap(p))), - ); - } + factory ActivityEventList.fromMap(Map map) { + return ActivityEventList( + total: map['total'], + events: List.from( + map['events'].map((p) => ActivityEvent.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "events": events.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "events": events.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/algo_argon2.dart b/lib/src/models/algo_argon2.dart index f80fa854..344a8770 100644 --- a/lib/src/models/algo_argon2.dart +++ b/lib/src/models/algo_argon2.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// AlgoArgon2 class AlgoArgon2 implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - /// Memory used to compute hash. - final int memoryCost; + /// Memory used to compute hash. + final int memoryCost; - /// Amount of time consumed to compute hash - final int timeCost; + /// Amount of time consumed to compute hash + final int timeCost; - /// Number of threads used to compute hash. - final int threads; + /// Number of threads used to compute hash. + final int threads; - AlgoArgon2({ - required this.type, - required this.memoryCost, - required this.timeCost, - required this.threads, - }); + AlgoArgon2({ + required this.type, + required this.memoryCost, + required this.timeCost, + required this.threads, + }); - factory AlgoArgon2.fromMap(Map map) { - return AlgoArgon2( - type: map['type'].toString(), - memoryCost: map['memoryCost'], - timeCost: map['timeCost'], - threads: map['threads'], - ); - } + factory AlgoArgon2.fromMap(Map map) { + return AlgoArgon2( + type: map['type'].toString(), + memoryCost: map['memoryCost'], + timeCost: map['timeCost'], + threads: map['threads'], + ); + } - @override - Map toMap() { - return { - "type": type, - "memoryCost": memoryCost, - "timeCost": timeCost, - "threads": threads, - }; - } + @override + Map toMap() { + return { + "type": type, + "memoryCost": memoryCost, + "timeCost": timeCost, + "threads": threads, + }; + } } diff --git a/lib/src/models/algo_bcrypt.dart b/lib/src/models/algo_bcrypt.dart index c51da4bb..9909265e 100644 --- a/lib/src/models/algo_bcrypt.dart +++ b/lib/src/models/algo_bcrypt.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoBcrypt class AlgoBcrypt implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoBcrypt({ - required this.type, - }); + AlgoBcrypt({ + required this.type, + }); - factory AlgoBcrypt.fromMap(Map map) { - return AlgoBcrypt( - type: map['type'].toString(), - ); - } + factory AlgoBcrypt.fromMap(Map map) { + return AlgoBcrypt( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_md5.dart b/lib/src/models/algo_md5.dart index 43523ab1..746fbd52 100644 --- a/lib/src/models/algo_md5.dart +++ b/lib/src/models/algo_md5.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoMD5 class AlgoMd5 implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoMd5({ - required this.type, - }); + AlgoMd5({ + required this.type, + }); - factory AlgoMd5.fromMap(Map map) { - return AlgoMd5( - type: map['type'].toString(), - ); - } + factory AlgoMd5.fromMap(Map map) { + return AlgoMd5( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_phpass.dart b/lib/src/models/algo_phpass.dart index 8562c4e3..cab45e49 100644 --- a/lib/src/models/algo_phpass.dart +++ b/lib/src/models/algo_phpass.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoPHPass class AlgoPhpass implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoPhpass({ - required this.type, - }); + AlgoPhpass({ + required this.type, + }); - factory AlgoPhpass.fromMap(Map map) { - return AlgoPhpass( - type: map['type'].toString(), - ); - } + factory AlgoPhpass.fromMap(Map map) { + return AlgoPhpass( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/algo_scrypt.dart b/lib/src/models/algo_scrypt.dart index 8e844839..a1648843 100644 --- a/lib/src/models/algo_scrypt.dart +++ b/lib/src/models/algo_scrypt.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// AlgoScrypt class AlgoScrypt implements Model { - /// Algo type. - final String type; - - /// CPU complexity of computed hash. - final int costCpu; - - /// Memory complexity of computed hash. - final int costMemory; - - /// Parallelization of computed hash. - final int costParallel; - - /// Length used to compute hash. - final int length; - - AlgoScrypt({ - required this.type, - required this.costCpu, - required this.costMemory, - required this.costParallel, - required this.length, - }); - - factory AlgoScrypt.fromMap(Map map) { - return AlgoScrypt( - type: map['type'].toString(), - costCpu: map['costCpu'], - costMemory: map['costMemory'], - costParallel: map['costParallel'], - length: map['length'], - ); - } - - @override - Map toMap() { - return { - "type": type, - "costCpu": costCpu, - "costMemory": costMemory, - "costParallel": costParallel, - "length": length, - }; - } + /// Algo type. + final String type; + + /// CPU complexity of computed hash. + final int costCpu; + + /// Memory complexity of computed hash. + final int costMemory; + + /// Parallelization of computed hash. + final int costParallel; + + /// Length used to compute hash. + final int length; + + AlgoScrypt({ + required this.type, + required this.costCpu, + required this.costMemory, + required this.costParallel, + required this.length, + }); + + factory AlgoScrypt.fromMap(Map map) { + return AlgoScrypt( + type: map['type'].toString(), + costCpu: map['costCpu'], + costMemory: map['costMemory'], + costParallel: map['costParallel'], + length: map['length'], + ); + } + + @override + Map toMap() { + return { + "type": type, + "costCpu": costCpu, + "costMemory": costMemory, + "costParallel": costParallel, + "length": length, + }; + } } diff --git a/lib/src/models/algo_scrypt_modified.dart b/lib/src/models/algo_scrypt_modified.dart index 5202db05..33ef4a6f 100644 --- a/lib/src/models/algo_scrypt_modified.dart +++ b/lib/src/models/algo_scrypt_modified.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// AlgoScryptModified class AlgoScryptModified implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - /// Salt used to compute hash. - final String salt; + /// Salt used to compute hash. + final String salt; - /// Separator used to compute hash. - final String saltSeparator; + /// Separator used to compute hash. + final String saltSeparator; - /// Key used to compute hash. - final String signerKey; + /// Key used to compute hash. + final String signerKey; - AlgoScryptModified({ - required this.type, - required this.salt, - required this.saltSeparator, - required this.signerKey, - }); + AlgoScryptModified({ + required this.type, + required this.salt, + required this.saltSeparator, + required this.signerKey, + }); - factory AlgoScryptModified.fromMap(Map map) { - return AlgoScryptModified( - type: map['type'].toString(), - salt: map['salt'].toString(), - saltSeparator: map['saltSeparator'].toString(), - signerKey: map['signerKey'].toString(), - ); - } + factory AlgoScryptModified.fromMap(Map map) { + return AlgoScryptModified( + type: map['type'].toString(), + salt: map['salt'].toString(), + saltSeparator: map['saltSeparator'].toString(), + signerKey: map['signerKey'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - "salt": salt, - "saltSeparator": saltSeparator, - "signerKey": signerKey, - }; - } + @override + Map toMap() { + return { + "type": type, + "salt": salt, + "saltSeparator": saltSeparator, + "signerKey": signerKey, + }; + } } diff --git a/lib/src/models/algo_sha.dart b/lib/src/models/algo_sha.dart index 3d08af9f..4984df75 100644 --- a/lib/src/models/algo_sha.dart +++ b/lib/src/models/algo_sha.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// AlgoSHA class AlgoSha implements Model { - /// Algo type. - final String type; + /// Algo type. + final String type; - AlgoSha({ - required this.type, - }); + AlgoSha({ + required this.type, + }); - factory AlgoSha.fromMap(Map map) { - return AlgoSha( - type: map['type'].toString(), - ); - } + factory AlgoSha.fromMap(Map map) { + return AlgoSha( + type: map['type'].toString(), + ); + } - @override - Map toMap() { - return { - "type": type, - }; - } + @override + Map toMap() { + return { + "type": type, + }; + } } diff --git a/lib/src/models/attribute_bigint.dart b/lib/src/models/attribute_bigint.dart index ad6d8825..b2c3da61 100644 --- a/lib/src/models/attribute_bigint.dart +++ b/lib/src/models/attribute_bigint.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// AttributeBigInt class AttributeBigint implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final int? min; + /// Minimum value to enforce for new documents. + final int? min; - /// Maximum value to enforce for new documents. - final int? max; + /// Maximum value to enforce for new documents. + final int? max; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final int? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final int? xdefault; - AttributeBigint({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + AttributeBigint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory AttributeBigint.fromMap(Map map) { - return AttributeBigint( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min'], - max: map['max'], - xdefault: map['default'], - ); - } + factory AttributeBigint.fromMap(Map map) { + return AttributeBigint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_boolean.dart b/lib/src/models/attribute_boolean.dart index 3a682ae3..1c250548 100644 --- a/lib/src/models/attribute_boolean.dart +++ b/lib/src/models/attribute_boolean.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// AttributeBoolean class AttributeBoolean implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final bool? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final bool? xdefault; - AttributeBoolean({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributeBoolean({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributeBoolean.fromMap(Map map) { - return AttributeBoolean( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default'], - ); - } + factory AttributeBoolean.fromMap(Map map) { + return AttributeBoolean( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_datetime.dart b/lib/src/models/attribute_datetime.dart index 59828b4f..2c0a5d09 100644 --- a/lib/src/models/attribute_datetime.dart +++ b/lib/src/models/attribute_datetime.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeDatetime class AttributeDatetime implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// ISO 8601 format. - final String format; + /// ISO 8601 format. + final String format; - /// Default value for attribute when not provided. Only null is optional - final String? xdefault; + /// Default value for attribute when not provided. Only null is optional + final String? xdefault; - AttributeDatetime({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeDatetime({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeDatetime.fromMap(Map map) { - return AttributeDatetime( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeDatetime.fromMap(Map map) { + return AttributeDatetime( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_email.dart b/lib/src/models/attribute_email.dart index 0a78bc62..f6f54b51 100644 --- a/lib/src/models/attribute_email.dart +++ b/lib/src/models/attribute_email.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeEmail class AttributeEmail implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeEmail({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeEmail({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeEmail.fromMap(Map map) { - return AttributeEmail( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeEmail.fromMap(Map map) { + return AttributeEmail( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_enum.dart b/lib/src/models/attribute_enum.dart index dd947620..078e1b5a 100644 --- a/lib/src/models/attribute_enum.dart +++ b/lib/src/models/attribute_enum.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// AttributeEnum class AttributeEnum implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Array of elements in enumerated type. - final List elements; + /// Array of elements in enumerated type. + final List elements; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeEnum({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.elements, - required this.format, - this.xdefault, - }); + AttributeEnum({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.elements, + required this.format, + this.xdefault, + }); - factory AttributeEnum.fromMap(Map map) { - return AttributeEnum( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - elements: List.from(map['elements'] ?? []), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeEnum.fromMap(Map map) { + return AttributeEnum( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + elements: List.from(map['elements'] ?? []), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "elements": elements, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_float.dart b/lib/src/models/attribute_float.dart index c964e467..09d14fb8 100644 --- a/lib/src/models/attribute_float.dart +++ b/lib/src/models/attribute_float.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// AttributeFloat class AttributeFloat implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final double? min; + /// Minimum value to enforce for new documents. + final double? min; - /// Maximum value to enforce for new documents. - final double? max; + /// Maximum value to enforce for new documents. + final double? max; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final double? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final double? xdefault; - AttributeFloat({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + AttributeFloat({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory AttributeFloat.fromMap(Map map) { - return AttributeFloat( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min']?.toDouble(), - max: map['max']?.toDouble(), - xdefault: map['default']?.toDouble(), - ); - } + factory AttributeFloat.fromMap(Map map) { + return AttributeFloat( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min']?.toDouble(), + max: map['max']?.toDouble(), + xdefault: map['default']?.toDouble(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_integer.dart b/lib/src/models/attribute_integer.dart index 5a0e23fd..215b0495 100644 --- a/lib/src/models/attribute_integer.dart +++ b/lib/src/models/attribute_integer.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// AttributeInteger class AttributeInteger implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final int? min; + /// Minimum value to enforce for new documents. + final int? min; - /// Maximum value to enforce for new documents. - final int? max; + /// Maximum value to enforce for new documents. + final int? max; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final int? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final int? xdefault; - AttributeInteger({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + AttributeInteger({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory AttributeInteger.fromMap(Map map) { - return AttributeInteger( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min'], - max: map['max'], - xdefault: map['default'], - ); - } + factory AttributeInteger.fromMap(Map map) { + return AttributeInteger( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_ip.dart b/lib/src/models/attribute_ip.dart index d6e0e53c..0382fd57 100644 --- a/lib/src/models/attribute_ip.dart +++ b/lib/src/models/attribute_ip.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeIP class AttributeIp implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeIp({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeIp({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeIp.fromMap(Map map) { - return AttributeIp( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeIp.fromMap(Map map) { + return AttributeIp( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_line.dart b/lib/src/models/attribute_line.dart index 67f07950..5a8ffefc 100644 --- a/lib/src/models/attribute_line.dart +++ b/lib/src/models/attribute_line.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// AttributeLine class AttributeLine implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final List? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final List? xdefault; - AttributeLine({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributeLine({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributeLine.fromMap(Map map) { - return AttributeLine( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory AttributeLine.fromMap(Map map) { + return AttributeLine( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_list.dart b/lib/src/models/attribute_list.dart index add46b52..3b6e3acb 100644 --- a/lib/src/models/attribute_list.dart +++ b/lib/src/models/attribute_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Attributes List class AttributeList implements Model { - /// Total number of attributes in the given collection. - final int total; + /// Total number of attributes in the given collection. + final int total; - /// List of attributes. - final List attributes; + /// List of attributes. + final List attributes; - AttributeList({ - required this.total, - required this.attributes, - }); + AttributeList({ + required this.total, + required this.attributes, + }); - factory AttributeList.fromMap(Map map) { - return AttributeList( - total: map['total'], - attributes: List.from(map['attributes'] ?? []), - ); - } + factory AttributeList.fromMap(Map map) { + return AttributeList( + total: map['total'], + attributes: List.from(map['attributes'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "attributes": attributes, - }; - } + @override + Map toMap() { + return { + "total": total, + "attributes": attributes, + }; + } } diff --git a/lib/src/models/attribute_longtext.dart b/lib/src/models/attribute_longtext.dart index 6b98f59b..31a77052 100644 --- a/lib/src/models/attribute_longtext.dart +++ b/lib/src/models/attribute_longtext.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeLongtext class AttributeLongtext implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeLongtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + AttributeLongtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory AttributeLongtext.fromMap(Map map) { - return AttributeLongtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeLongtext.fromMap(Map map) { + return AttributeLongtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_mediumtext.dart b/lib/src/models/attribute_mediumtext.dart index ea0417c7..68832e05 100644 --- a/lib/src/models/attribute_mediumtext.dart +++ b/lib/src/models/attribute_mediumtext.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeMediumtext class AttributeMediumtext implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeMediumtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + AttributeMediumtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory AttributeMediumtext.fromMap(Map map) { - return AttributeMediumtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeMediumtext.fromMap(Map map) { + return AttributeMediumtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_point.dart b/lib/src/models/attribute_point.dart index 51befcd2..73d1250b 100644 --- a/lib/src/models/attribute_point.dart +++ b/lib/src/models/attribute_point.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// AttributePoint class AttributePoint implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final List? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final List? xdefault; - AttributePoint({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributePoint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributePoint.fromMap(Map map) { - return AttributePoint( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory AttributePoint.fromMap(Map map) { + return AttributePoint( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_polygon.dart b/lib/src/models/attribute_polygon.dart index 10074e30..8815fec1 100644 --- a/lib/src/models/attribute_polygon.dart +++ b/lib/src/models/attribute_polygon.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// AttributePolygon class AttributePolygon implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final List? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final List? xdefault; - AttributePolygon({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + AttributePolygon({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory AttributePolygon.fromMap(Map map) { - return AttributePolygon( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory AttributePolygon.fromMap(Map map) { + return AttributePolygon( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_relationship.dart b/lib/src/models/attribute_relationship.dart index 262c6fa3..de395001 100644 --- a/lib/src/models/attribute_relationship.dart +++ b/lib/src/models/attribute_relationship.dart @@ -2,101 +2,102 @@ part of '../../models.dart'; /// AttributeRelationship class AttributeRelationship implements Model { - /// Attribute Key. - final String key; - - /// Attribute type. - final String type; - - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; - - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; - - /// Is attribute required? - final bool xrequired; - - /// Is attribute an array? - final bool? array; - - /// Attribute creation date in ISO 8601 format. - final String $createdAt; - - /// Attribute update date in ISO 8601 format. - final String $updatedAt; - - /// The ID of the related collection. - final String relatedCollection; - - /// The type of the relationship. - final String relationType; - - /// Is the relationship two-way? - final bool twoWay; - - /// The key of the two-way relationship. - final String twoWayKey; - - /// How deleting the parent document will propagate to child documents. - final String onDelete; - - /// Whether this is the parent or child side of the relationship - final String side; - - AttributeRelationship({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.relatedCollection, - required this.relationType, - required this.twoWay, - required this.twoWayKey, - required this.onDelete, - required this.side, - }); - - factory AttributeRelationship.fromMap(Map map) { - return AttributeRelationship( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - relatedCollection: map['relatedCollection'].toString(), - relationType: map['relationType'].toString(), - twoWay: map['twoWay'], - twoWayKey: map['twoWayKey'].toString(), - onDelete: map['onDelete'].toString(), - side: map['side'].toString(), - ); - } - - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "relatedCollection": relatedCollection, - "relationType": relationType, - "twoWay": twoWay, - "twoWayKey": twoWayKey, - "onDelete": onDelete, - "side": side, - }; - } + /// Attribute Key. + final String key; + + /// Attribute type. + final String type; + + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; + + /// Is attribute required? + final bool xrequired; + + /// Is attribute an array? + final bool? array; + + /// Attribute creation date in ISO 8601 format. + final String $createdAt; + + /// Attribute update date in ISO 8601 format. + final String $updatedAt; + + /// The ID of the related collection. + final String relatedCollection; + + /// The type of the relationship. + final String relationType; + + /// Is the relationship two-way? + final bool twoWay; + + /// The key of the two-way relationship. + final String twoWayKey; + + /// How deleting the parent document will propagate to child documents. + final String onDelete; + + /// Whether this is the parent or child side of the relationship + final String side; + + AttributeRelationship({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.relatedCollection, + required this.relationType, + required this.twoWay, + required this.twoWayKey, + required this.onDelete, + required this.side, + }); + + factory AttributeRelationship.fromMap(Map map) { + return AttributeRelationship( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + relatedCollection: map['relatedCollection'].toString(), + relationType: map['relationType'].toString(), + twoWay: map['twoWay'], + twoWayKey: map['twoWayKey'].toString(), + onDelete: map['onDelete'].toString(), + side: map['side'].toString(), + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "relatedCollection": relatedCollection, + "relationType": relationType, + "twoWay": twoWay, + "twoWayKey": twoWayKey, + "onDelete": onDelete, + "side": side, + }; + } } diff --git a/lib/src/models/attribute_string.dart b/lib/src/models/attribute_string.dart index 9154ac0b..bba7f46d 100644 --- a/lib/src/models/attribute_string.dart +++ b/lib/src/models/attribute_string.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// AttributeString class AttributeString implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Attribute size. - final int size; + /// Attribute size. + final int size; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeString({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + AttributeString({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory AttributeString.fromMap(Map map) { - return AttributeString( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeString.fromMap(Map map) { + return AttributeString( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_text.dart b/lib/src/models/attribute_text.dart index a1b13f2f..5a49a975 100644 --- a/lib/src/models/attribute_text.dart +++ b/lib/src/models/attribute_text.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeText class AttributeText implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeText({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + AttributeText({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory AttributeText.fromMap(Map map) { - return AttributeText( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeText.fromMap(Map map) { + return AttributeText( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/attribute_url.dart b/lib/src/models/attribute_url.dart index 0fde7dde..95ef514a 100644 --- a/lib/src/models/attribute_url.dart +++ b/lib/src/models/attribute_url.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// AttributeURL class AttributeUrl implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - AttributeUrl({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + AttributeUrl({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory AttributeUrl.fromMap(Map map) { - return AttributeUrl( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory AttributeUrl.fromMap(Map map) { + return AttributeUrl( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/attribute_varchar.dart b/lib/src/models/attribute_varchar.dart index 2b544e49..37b4440e 100644 --- a/lib/src/models/attribute_varchar.dart +++ b/lib/src/models/attribute_varchar.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// AttributeVarchar class AttributeVarchar implements Model { - /// Attribute Key. - final String key; + /// Attribute Key. + final String key; - /// Attribute type. - final String type; + /// Attribute type. + final String type; - /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.AttributeStatus status; + /// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.AttributeStatus status; - /// Error message. Displays error generated on failure of creating or deleting an attribute. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an attribute. + final String error; - /// Is attribute required? - final bool xrequired; + /// Is attribute required? + final bool xrequired; - /// Is attribute an array? - final bool? array; + /// Is attribute an array? + final bool? array; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - /// Attribute size. - final int size; + /// Attribute size. + final int size; - /// Default value for attribute when not provided. Cannot be set when attribute is required. - final String? xdefault; + /// Default value for attribute when not provided. Cannot be set when attribute is required. + final String? xdefault; - /// Defines whether this attribute is encrypted or not. - final bool? encrypt; + /// Defines whether this attribute is encrypted or not. + final bool? encrypt; - AttributeVarchar({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + AttributeVarchar({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory AttributeVarchar.fromMap(Map map) { - return AttributeVarchar( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.AttributeStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory AttributeVarchar.fromMap(Map map) { + return AttributeVarchar( + key: map['key'].toString(), + type: map['type'].toString(), + status: enums.AttributeStatus.values + .firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/auth_provider.dart b/lib/src/models/auth_provider.dart index 79444ca6..f2bb07c0 100644 --- a/lib/src/models/auth_provider.dart +++ b/lib/src/models/auth_provider.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// AuthProvider class AuthProvider implements Model { - /// Auth Provider. - final String key; - - /// Auth Provider name. - final String name; - - /// OAuth 2.0 application ID. - final String appId; - - /// OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. - final String secret; - - /// Auth Provider is active and can be used to create session. - final bool enabled; - - AuthProvider({ - required this.key, - required this.name, - required this.appId, - required this.secret, - required this.enabled, - }); - - factory AuthProvider.fromMap(Map map) { - return AuthProvider( - key: map['key'].toString(), - name: map['name'].toString(), - appId: map['appId'].toString(), - secret: map['secret'].toString(), - enabled: map['enabled'], - ); - } - - @override - Map toMap() { - return { - "key": key, - "name": name, - "appId": appId, - "secret": secret, - "enabled": enabled, - }; - } + /// Auth Provider. + final String key; + + /// Auth Provider name. + final String name; + + /// OAuth 2.0 application ID. + final String appId; + + /// OAuth 2.0 application secret. Might be JSON string if provider requires extra configuration. This property is write-only and always returned empty. + final String secret; + + /// Auth Provider is active and can be used to create session. + final bool enabled; + + AuthProvider({ + required this.key, + required this.name, + required this.appId, + required this.secret, + required this.enabled, + }); + + factory AuthProvider.fromMap(Map map) { + return AuthProvider( + key: map['key'].toString(), + name: map['name'].toString(), + appId: map['appId'].toString(), + secret: map['secret'].toString(), + enabled: map['enabled'], + ); + } + + @override + Map toMap() { + return { + "key": key, + "name": name, + "appId": appId, + "secret": secret, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/backup_archive.dart b/lib/src/models/backup_archive.dart index e4f10f69..15ea9a24 100644 --- a/lib/src/models/backup_archive.dart +++ b/lib/src/models/backup_archive.dart @@ -2,89 +2,89 @@ part of '../../models.dart'; /// Archive class BackupArchive implements Model { - /// Archive ID. - final String $id; + /// Archive ID. + final String $id; - /// Archive creation time in ISO 8601 format. - final String $createdAt; + /// Archive creation time in ISO 8601 format. + final String $createdAt; - /// Archive update date in ISO 8601 format. - final String $updatedAt; + /// Archive update date in ISO 8601 format. + final String $updatedAt; - /// Archive policy ID. - final String policyId; + /// Archive policy ID. + final String policyId; - /// Archive size in bytes. - final int size; + /// Archive size in bytes. + final int size; - /// The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. - final String status; + /// The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. + final String status; - /// The backup start time. - final String startedAt; + /// The backup start time. + final String startedAt; - /// Migration ID. - final String migrationId; + /// Migration ID. + final String migrationId; - /// The services that are backed up by this archive. - final List services; + /// The services that are backed up by this archive. + final List services; - /// The resources that are backed up by this archive. - final List resources; + /// The resources that are backed up by this archive. + final List resources; - /// The resource ID to backup. Set only if this archive should backup a single resource. - final String? resourceId; + /// The resource ID to backup. Set only if this archive should backup a single resource. + final String? resourceId; - /// The resource type to backup. Set only if this archive should backup a single resource. - final String? resourceType; + /// The resource type to backup. Set only if this archive should backup a single resource. + final String? resourceType; - BackupArchive({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.policyId, - required this.size, - required this.status, - required this.startedAt, - required this.migrationId, - required this.services, - required this.resources, - this.resourceId, - this.resourceType, - }); + BackupArchive({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.policyId, + required this.size, + required this.status, + required this.startedAt, + required this.migrationId, + required this.services, + required this.resources, + this.resourceId, + this.resourceType, + }); - factory BackupArchive.fromMap(Map map) { - return BackupArchive( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - policyId: map['policyId'].toString(), - size: map['size'], - status: map['status'].toString(), - startedAt: map['startedAt'].toString(), - migrationId: map['migrationId'].toString(), - services: List.from(map['services'] ?? []), - resources: List.from(map['resources'] ?? []), - resourceId: map['resourceId']?.toString(), - resourceType: map['resourceType']?.toString(), - ); - } + factory BackupArchive.fromMap(Map map) { + return BackupArchive( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + policyId: map['policyId'].toString(), + size: map['size'], + status: map['status'].toString(), + startedAt: map['startedAt'].toString(), + migrationId: map['migrationId'].toString(), + services: List.from(map['services'] ?? []), + resources: List.from(map['resources'] ?? []), + resourceId: map['resourceId']?.toString(), + resourceType: map['resourceType']?.toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "policyId": policyId, - "size": size, - "status": status, - "startedAt": startedAt, - "migrationId": migrationId, - "services": services, - "resources": resources, - "resourceId": resourceId, - "resourceType": resourceType, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "policyId": policyId, + "size": size, + "status": status, + "startedAt": startedAt, + "migrationId": migrationId, + "services": services, + "resources": resources, + "resourceId": resourceId, + "resourceType": resourceType, + }; + } } diff --git a/lib/src/models/backup_archive_list.dart b/lib/src/models/backup_archive_list.dart index 6e3d4d32..2ab40493 100644 --- a/lib/src/models/backup_archive_list.dart +++ b/lib/src/models/backup_archive_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Backup archive list class BackupArchiveList implements Model { - /// Total number of archives that matched your query. - final int total; + /// Total number of archives that matched your query. + final int total; - /// List of archives. - final List archives; + /// List of archives. + final List archives; - BackupArchiveList({ - required this.total, - required this.archives, - }); + BackupArchiveList({ + required this.total, + required this.archives, + }); - factory BackupArchiveList.fromMap(Map map) { - return BackupArchiveList( - total: map['total'], - archives: List.from(map['archives'].map((p) => BackupArchive.fromMap(p))), - ); - } + factory BackupArchiveList.fromMap(Map map) { + return BackupArchiveList( + total: map['total'], + archives: List.from( + map['archives'].map((p) => BackupArchive.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "archives": archives.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "archives": archives.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/backup_policy.dart b/lib/src/models/backup_policy.dart index 892bc89d..c7e1aa2f 100644 --- a/lib/src/models/backup_policy.dart +++ b/lib/src/models/backup_policy.dart @@ -2,83 +2,83 @@ part of '../../models.dart'; /// backup class BackupPolicy implements Model { - /// Backup policy ID. - final String $id; + /// Backup policy ID. + final String $id; - /// Backup policy name. - final String name; + /// Backup policy name. + final String name; - /// Policy creation date in ISO 8601 format. - final String $createdAt; + /// Policy creation date in ISO 8601 format. + final String $createdAt; - /// Policy update date in ISO 8601 format. - final String $updatedAt; + /// Policy update date in ISO 8601 format. + final String $updatedAt; - /// The services that are backed up by this policy. - final List services; + /// The services that are backed up by this policy. + final List services; - /// The resources that are backed up by this policy. - final List resources; + /// The resources that are backed up by this policy. + final List resources; - /// The resource ID to backup. Set only if this policy should backup a single resource. - final String? resourceId; + /// The resource ID to backup. Set only if this policy should backup a single resource. + final String? resourceId; - /// The resource type to backup. Set only if this policy should backup a single resource. - final String? resourceType; + /// The resource type to backup. Set only if this policy should backup a single resource. + final String? resourceType; - /// How many days to keep the backup before it will be automatically deleted. - final int retention; + /// How many days to keep the backup before it will be automatically deleted. + final int retention; - /// Policy backup schedule in CRON format. - final String schedule; + /// Policy backup schedule in CRON format. + final String schedule; - /// Is this policy enabled. - final bool enabled; + /// Is this policy enabled. + final bool enabled; - BackupPolicy({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.services, - required this.resources, - this.resourceId, - this.resourceType, - required this.retention, - required this.schedule, - required this.enabled, - }); + BackupPolicy({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.services, + required this.resources, + this.resourceId, + this.resourceType, + required this.retention, + required this.schedule, + required this.enabled, + }); - factory BackupPolicy.fromMap(Map map) { - return BackupPolicy( - $id: map['\$id'].toString(), - name: map['name'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - services: List.from(map['services'] ?? []), - resources: List.from(map['resources'] ?? []), - resourceId: map['resourceId']?.toString(), - resourceType: map['resourceType']?.toString(), - retention: map['retention'], - schedule: map['schedule'].toString(), - enabled: map['enabled'], - ); - } + factory BackupPolicy.fromMap(Map map) { + return BackupPolicy( + $id: map['\$id'].toString(), + name: map['name'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + services: List.from(map['services'] ?? []), + resources: List.from(map['resources'] ?? []), + resourceId: map['resourceId']?.toString(), + resourceType: map['resourceType']?.toString(), + retention: map['retention'], + schedule: map['schedule'].toString(), + enabled: map['enabled'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "services": services, - "resources": resources, - "resourceId": resourceId, - "resourceType": resourceType, - "retention": retention, - "schedule": schedule, - "enabled": enabled, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "services": services, + "resources": resources, + "resourceId": resourceId, + "resourceType": resourceType, + "retention": retention, + "schedule": schedule, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/backup_policy_list.dart b/lib/src/models/backup_policy_list.dart index a158827a..da7da51d 100644 --- a/lib/src/models/backup_policy_list.dart +++ b/lib/src/models/backup_policy_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Backup policy list class BackupPolicyList implements Model { - /// Total number of policies that matched your query. - final int total; + /// Total number of policies that matched your query. + final int total; - /// List of policies. - final List policies; + /// List of policies. + final List policies; - BackupPolicyList({ - required this.total, - required this.policies, - }); + BackupPolicyList({ + required this.total, + required this.policies, + }); - factory BackupPolicyList.fromMap(Map map) { - return BackupPolicyList( - total: map['total'], - policies: List.from(map['policies'].map((p) => BackupPolicy.fromMap(p))), - ); - } + factory BackupPolicyList.fromMap(Map map) { + return BackupPolicyList( + total: map['total'], + policies: List.from( + map['policies'].map((p) => BackupPolicy.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "policies": policies.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "policies": policies.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/backup_restoration.dart b/lib/src/models/backup_restoration.dart index 16d00c48..ad565a5d 100644 --- a/lib/src/models/backup_restoration.dart +++ b/lib/src/models/backup_restoration.dart @@ -2,83 +2,83 @@ part of '../../models.dart'; /// Restoration class BackupRestoration implements Model { - /// Restoration ID. - final String $id; + /// Restoration ID. + final String $id; - /// Restoration creation time in ISO 8601 format. - final String $createdAt; + /// Restoration creation time in ISO 8601 format. + final String $createdAt; - /// Restoration update date in ISO 8601 format. - final String $updatedAt; + /// Restoration update date in ISO 8601 format. + final String $updatedAt; - /// Backup archive ID. - final String archiveId; + /// Backup archive ID. + final String archiveId; - /// Backup policy ID. - final String policyId; + /// Backup policy ID. + final String policyId; - /// The status of the restoration. Possible values: pending, downloading, processing, completed, failed. - final String status; + /// The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + final String status; - /// The backup start time. - final String startedAt; + /// The backup start time. + final String startedAt; - /// Migration ID. - final String migrationId; + /// Migration ID. + final String migrationId; - /// The services that are backed up by this policy. - final List services; + /// The services that are backed up by this policy. + final List services; - /// The resources that are backed up by this policy. - final List resources; + /// The resources that are backed up by this policy. + final List resources; - /// Optional data in key-value object. - final String options; + /// Optional data in key-value object. + final String options; - BackupRestoration({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.archiveId, - required this.policyId, - required this.status, - required this.startedAt, - required this.migrationId, - required this.services, - required this.resources, - required this.options, - }); + BackupRestoration({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.archiveId, + required this.policyId, + required this.status, + required this.startedAt, + required this.migrationId, + required this.services, + required this.resources, + required this.options, + }); - factory BackupRestoration.fromMap(Map map) { - return BackupRestoration( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - archiveId: map['archiveId'].toString(), - policyId: map['policyId'].toString(), - status: map['status'].toString(), - startedAt: map['startedAt'].toString(), - migrationId: map['migrationId'].toString(), - services: List.from(map['services'] ?? []), - resources: List.from(map['resources'] ?? []), - options: map['options'].toString(), - ); - } + factory BackupRestoration.fromMap(Map map) { + return BackupRestoration( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + archiveId: map['archiveId'].toString(), + policyId: map['policyId'].toString(), + status: map['status'].toString(), + startedAt: map['startedAt'].toString(), + migrationId: map['migrationId'].toString(), + services: List.from(map['services'] ?? []), + resources: List.from(map['resources'] ?? []), + options: map['options'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "archiveId": archiveId, - "policyId": policyId, - "status": status, - "startedAt": startedAt, - "migrationId": migrationId, - "services": services, - "resources": resources, - "options": options, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "archiveId": archiveId, + "policyId": policyId, + "status": status, + "startedAt": startedAt, + "migrationId": migrationId, + "services": services, + "resources": resources, + "options": options, + }; + } } diff --git a/lib/src/models/backup_restoration_list.dart b/lib/src/models/backup_restoration_list.dart index 8aaf2f46..f1d3a9f0 100644 --- a/lib/src/models/backup_restoration_list.dart +++ b/lib/src/models/backup_restoration_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Backup restoration list class BackupRestorationList implements Model { - /// Total number of restorations that matched your query. - final int total; + /// Total number of restorations that matched your query. + final int total; - /// List of restorations. - final List restorations; + /// List of restorations. + final List restorations; - BackupRestorationList({ - required this.total, - required this.restorations, - }); + BackupRestorationList({ + required this.total, + required this.restorations, + }); - factory BackupRestorationList.fromMap(Map map) { - return BackupRestorationList( - total: map['total'], - restorations: List.from(map['restorations'].map((p) => BackupRestoration.fromMap(p))), - ); - } + factory BackupRestorationList.fromMap(Map map) { + return BackupRestorationList( + total: map['total'], + restorations: List.from( + map['restorations'].map((p) => BackupRestoration.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "restorations": restorations.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "restorations": restorations.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/billing_limits.dart b/lib/src/models/billing_limits.dart index b31a1829..e775c07e 100644 --- a/lib/src/models/billing_limits.dart +++ b/lib/src/models/billing_limits.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// BillingLimits class BillingLimits implements Model { - /// Bandwidth limit - final int bandwidth; + /// Bandwidth limit + final int bandwidth; - /// Storage limit - final int storage; + /// Storage limit + final int storage; - /// Users limit - final int users; + /// Users limit + final int users; - /// Executions limit - final int executions; + /// Executions limit + final int executions; - /// GBHours limit - final int GBHours; + /// GBHours limit + final int GBHours; - /// Image transformations limit - final int imageTransformations; + /// Image transformations limit + final int imageTransformations; - /// Auth phone limit - final int authPhone; + /// Auth phone limit + final int authPhone; - /// Budget limit percentage - final int budgetLimit; + /// Budget limit percentage + final int budgetLimit; - BillingLimits({ - required this.bandwidth, - required this.storage, - required this.users, - required this.executions, - required this.GBHours, - required this.imageTransformations, - required this.authPhone, - required this.budgetLimit, - }); + BillingLimits({ + required this.bandwidth, + required this.storage, + required this.users, + required this.executions, + required this.GBHours, + required this.imageTransformations, + required this.authPhone, + required this.budgetLimit, + }); - factory BillingLimits.fromMap(Map map) { - return BillingLimits( - bandwidth: map['bandwidth'], - storage: map['storage'], - users: map['users'], - executions: map['executions'], - GBHours: map['GBHours'], - imageTransformations: map['imageTransformations'], - authPhone: map['authPhone'], - budgetLimit: map['budgetLimit'], - ); - } + factory BillingLimits.fromMap(Map map) { + return BillingLimits( + bandwidth: map['bandwidth'], + storage: map['storage'], + users: map['users'], + executions: map['executions'], + GBHours: map['GBHours'], + imageTransformations: map['imageTransformations'], + authPhone: map['authPhone'], + budgetLimit: map['budgetLimit'], + ); + } - @override - Map toMap() { - return { - "bandwidth": bandwidth, - "storage": storage, - "users": users, - "executions": executions, - "GBHours": GBHours, - "imageTransformations": imageTransformations, - "authPhone": authPhone, - "budgetLimit": budgetLimit, - }; - } + @override + Map toMap() { + return { + "bandwidth": bandwidth, + "storage": storage, + "users": users, + "executions": executions, + "GBHours": GBHours, + "imageTransformations": imageTransformations, + "authPhone": authPhone, + "budgetLimit": budgetLimit, + }; + } } diff --git a/lib/src/models/block.dart b/lib/src/models/block.dart index 71d8af14..9825fd6e 100644 --- a/lib/src/models/block.dart +++ b/lib/src/models/block.dart @@ -2,77 +2,77 @@ part of '../../models.dart'; /// Block class Block implements Model { - /// Block creation date in ISO 8601 format. - final String $createdAt; + /// Block creation date in ISO 8601 format. + final String $createdAt; - /// Resource type that is blocked - final String resourceType; + /// Resource type that is blocked + final String resourceType; - /// Resource identifier that is blocked - final String resourceId; + /// Resource identifier that is blocked + final String resourceId; - /// Reason for the block. Can be null if no reason was provided. - final String? reason; + /// Reason for the block. Can be null if no reason was provided. + final String? reason; - /// Block expiration date in ISO 8601 format. Can be null if the block does not expire. - final String? expiredAt; + /// Block expiration date in ISO 8601 format. Can be null if the block does not expire. + final String? expiredAt; - /// Name of the project this block applies to. - final String projectName; + /// Name of the project this block applies to. + final String projectName; - /// Region of the project this block applies to. - final String region; + /// Region of the project this block applies to. + final String region; - /// Name of the organization that owns the project. - final String organizationName; + /// Name of the organization that owns the project. + final String organizationName; - /// ID of the organization that owns the project. - final String organizationId; + /// ID of the organization that owns the project. + final String organizationId; - /// Billing plan of the organization that owns the project. - final String billingPlan; + /// Billing plan of the organization that owns the project. + final String billingPlan; - Block({ - required this.$createdAt, - required this.resourceType, - required this.resourceId, - this.reason, - this.expiredAt, - required this.projectName, - required this.region, - required this.organizationName, - required this.organizationId, - required this.billingPlan, - }); + Block({ + required this.$createdAt, + required this.resourceType, + required this.resourceId, + this.reason, + this.expiredAt, + required this.projectName, + required this.region, + required this.organizationName, + required this.organizationId, + required this.billingPlan, + }); - factory Block.fromMap(Map map) { - return Block( - $createdAt: map['\$createdAt'].toString(), - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - reason: map['reason']?.toString(), - expiredAt: map['expiredAt']?.toString(), - projectName: map['projectName'].toString(), - region: map['region'].toString(), - organizationName: map['organizationName'].toString(), - organizationId: map['organizationId'].toString(), - billingPlan: map['billingPlan'].toString(), - ); - } + factory Block.fromMap(Map map) { + return Block( + $createdAt: map['\$createdAt'].toString(), + resourceType: map['resourceType'].toString(), + resourceId: map['resourceId'].toString(), + reason: map['reason']?.toString(), + expiredAt: map['expiredAt']?.toString(), + projectName: map['projectName'].toString(), + region: map['region'].toString(), + organizationName: map['organizationName'].toString(), + organizationId: map['organizationId'].toString(), + billingPlan: map['billingPlan'].toString(), + ); + } - @override - Map toMap() { - return { - "\$createdAt": $createdAt, - "resourceType": resourceType, - "resourceId": resourceId, - "reason": reason, - "expiredAt": expiredAt, - "projectName": projectName, - "region": region, - "organizationName": organizationName, - "organizationId": organizationId, - "billingPlan": billingPlan, - }; - } + @override + Map toMap() { + return { + "\$createdAt": $createdAt, + "resourceType": resourceType, + "resourceId": resourceId, + "reason": reason, + "expiredAt": expiredAt, + "projectName": projectName, + "region": region, + "organizationName": organizationName, + "organizationId": organizationId, + "billingPlan": billingPlan, + }; + } } diff --git a/lib/src/models/bucket.dart b/lib/src/models/bucket.dart index 768062b5..2a9d5df8 100644 --- a/lib/src/models/bucket.dart +++ b/lib/src/models/bucket.dart @@ -2,101 +2,101 @@ part of '../../models.dart'; /// Bucket class Bucket implements Model { - /// Bucket ID. - final String $id; - - /// Bucket creation time in ISO 8601 format. - final String $createdAt; - - /// Bucket update date in ISO 8601 format. - final String $updatedAt; - - /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; - - /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - final bool fileSecurity; - - /// Bucket name. - final String name; - - /// Bucket enabled. - final bool enabled; - - /// Maximum file size supported. - final int maximumFileSize; - - /// Allowed file extensions. - final List allowedFileExtensions; - - /// Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - final String compression; - - /// Bucket is encrypted. - final bool encryption; - - /// Virus scanning is enabled. - final bool antivirus; - - /// Image transformations are enabled. - final bool transformations; - - /// Total size of this bucket in bytes. - final int totalSize; - - Bucket({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.fileSecurity, - required this.name, - required this.enabled, - required this.maximumFileSize, - required this.allowedFileExtensions, - required this.compression, - required this.encryption, - required this.antivirus, - required this.transformations, - required this.totalSize, - }); - - factory Bucket.fromMap(Map map) { - return Bucket( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - fileSecurity: map['fileSecurity'], - name: map['name'].toString(), - enabled: map['enabled'], - maximumFileSize: map['maximumFileSize'], - allowedFileExtensions: List.from(map['allowedFileExtensions'] ?? []), - compression: map['compression'].toString(), - encryption: map['encryption'], - antivirus: map['antivirus'], - transformations: map['transformations'], - totalSize: map['totalSize'], - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "fileSecurity": fileSecurity, - "name": name, - "enabled": enabled, - "maximumFileSize": maximumFileSize, - "allowedFileExtensions": allowedFileExtensions, - "compression": compression, - "encryption": encryption, - "antivirus": antivirus, - "transformations": transformations, - "totalSize": totalSize, - }; - } + /// Bucket ID. + final String $id; + + /// Bucket creation time in ISO 8601 format. + final String $createdAt; + + /// Bucket update date in ISO 8601 format. + final String $updatedAt; + + /// Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool fileSecurity; + + /// Bucket name. + final String name; + + /// Bucket enabled. + final bool enabled; + + /// Maximum file size supported. + final int maximumFileSize; + + /// Allowed file extensions. + final List allowedFileExtensions; + + /// Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + final String compression; + + /// Bucket is encrypted. + final bool encryption; + + /// Virus scanning is enabled. + final bool antivirus; + + /// Image transformations are enabled. + final bool transformations; + + /// Total size of this bucket in bytes. + final int totalSize; + + Bucket({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.fileSecurity, + required this.name, + required this.enabled, + required this.maximumFileSize, + required this.allowedFileExtensions, + required this.compression, + required this.encryption, + required this.antivirus, + required this.transformations, + required this.totalSize, + }); + + factory Bucket.fromMap(Map map) { + return Bucket( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + fileSecurity: map['fileSecurity'], + name: map['name'].toString(), + enabled: map['enabled'], + maximumFileSize: map['maximumFileSize'], + allowedFileExtensions: List.from(map['allowedFileExtensions'] ?? []), + compression: map['compression'].toString(), + encryption: map['encryption'], + antivirus: map['antivirus'], + transformations: map['transformations'], + totalSize: map['totalSize'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "fileSecurity": fileSecurity, + "name": name, + "enabled": enabled, + "maximumFileSize": maximumFileSize, + "allowedFileExtensions": allowedFileExtensions, + "compression": compression, + "encryption": encryption, + "antivirus": antivirus, + "transformations": transformations, + "totalSize": totalSize, + }; + } } diff --git a/lib/src/models/bucket_list.dart b/lib/src/models/bucket_list.dart index 20017cd2..5be8fa5d 100644 --- a/lib/src/models/bucket_list.dart +++ b/lib/src/models/bucket_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Buckets List class BucketList implements Model { - /// Total number of buckets that matched your query. - final int total; + /// Total number of buckets that matched your query. + final int total; - /// List of buckets. - final List buckets; + /// List of buckets. + final List buckets; - BucketList({ - required this.total, - required this.buckets, - }); + BucketList({ + required this.total, + required this.buckets, + }); - factory BucketList.fromMap(Map map) { - return BucketList( - total: map['total'], - buckets: List.from(map['buckets'].map((p) => Bucket.fromMap(p))), - ); - } + factory BucketList.fromMap(Map map) { + return BucketList( + total: map['total'], + buckets: List.from(map['buckets'].map((p) => Bucket.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "buckets": buckets.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "buckets": buckets.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/collection.dart b/lib/src/models/collection.dart index 11e8e347..70c9ddde 100644 --- a/lib/src/models/collection.dart +++ b/lib/src/models/collection.dart @@ -2,89 +2,89 @@ part of '../../models.dart'; /// Collection class Collection implements Model { - /// Collection ID. - final String $id; + /// Collection ID. + final String $id; - /// Collection creation date in ISO 8601 format. - final String $createdAt; + /// Collection creation date in ISO 8601 format. + final String $createdAt; - /// Collection update date in ISO 8601 format. - final String $updatedAt; + /// Collection update date in ISO 8601 format. + final String $updatedAt; - /// Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// Database ID. - final String databaseId; + /// Database ID. + final String databaseId; - /// Collection name. - final String name; + /// Collection name. + final String name; - /// Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. - final bool enabled; + /// Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. + final bool enabled; - /// Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - final bool documentSecurity; + /// Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool documentSecurity; - /// Collection attributes. - final List attributes; + /// Collection attributes. + final List attributes; - /// Collection indexes. - final List indexes; + /// Collection indexes. + final List indexes; - /// Maximum document size in bytes. Returns 0 when no limit applies. - final int bytesMax; + /// Maximum document size in bytes. Returns 0 when no limit applies. + final int bytesMax; - /// Currently used document size in bytes based on defined attributes. - final int bytesUsed; + /// Currently used document size in bytes based on defined attributes. + final int bytesUsed; - Collection({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.databaseId, - required this.name, - required this.enabled, - required this.documentSecurity, - required this.attributes, - required this.indexes, - required this.bytesMax, - required this.bytesUsed, - }); + Collection({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.databaseId, + required this.name, + required this.enabled, + required this.documentSecurity, + required this.attributes, + required this.indexes, + required this.bytesMax, + required this.bytesUsed, + }); - factory Collection.fromMap(Map map) { - return Collection( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - databaseId: map['databaseId'].toString(), - name: map['name'].toString(), - enabled: map['enabled'], - documentSecurity: map['documentSecurity'], - attributes: List.from(map['attributes'] ?? []), - indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), - bytesMax: map['bytesMax'], - bytesUsed: map['bytesUsed'], - ); - } + factory Collection.fromMap(Map map) { + return Collection( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + databaseId: map['databaseId'].toString(), + name: map['name'].toString(), + enabled: map['enabled'], + documentSecurity: map['documentSecurity'], + attributes: List.from(map['attributes'] ?? []), + indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), + bytesMax: map['bytesMax'], + bytesUsed: map['bytesUsed'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "databaseId": databaseId, - "name": name, - "enabled": enabled, - "documentSecurity": documentSecurity, - "attributes": attributes, - "indexes": indexes.map((p) => p.toMap()).toList(), - "bytesMax": bytesMax, - "bytesUsed": bytesUsed, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "databaseId": databaseId, + "name": name, + "enabled": enabled, + "documentSecurity": documentSecurity, + "attributes": attributes, + "indexes": indexes.map((p) => p.toMap()).toList(), + "bytesMax": bytesMax, + "bytesUsed": bytesUsed, + }; + } } diff --git a/lib/src/models/collection_list.dart b/lib/src/models/collection_list.dart index 10376235..c46ad20e 100644 --- a/lib/src/models/collection_list.dart +++ b/lib/src/models/collection_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Collections List class CollectionList implements Model { - /// Total number of collections that matched your query. - final int total; + /// Total number of collections that matched your query. + final int total; - /// List of collections. - final List collections; + /// List of collections. + final List collections; - CollectionList({ - required this.total, - required this.collections, - }); + CollectionList({ + required this.total, + required this.collections, + }); - factory CollectionList.fromMap(Map map) { - return CollectionList( - total: map['total'], - collections: List.from(map['collections'].map((p) => Collection.fromMap(p))), - ); - } + factory CollectionList.fromMap(Map map) { + return CollectionList( + total: map['total'], + collections: List.from( + map['collections'].map((p) => Collection.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "collections": collections.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "collections": collections.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_bigint.dart b/lib/src/models/column_bigint.dart index 1a93f9d9..b95ecaf4 100644 --- a/lib/src/models/column_bigint.dart +++ b/lib/src/models/column_bigint.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// ColumnBigInt class ColumnBigint implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final int? min; + /// Minimum value to enforce for new documents. + final int? min; - /// Maximum value to enforce for new documents. - final int? max; + /// Maximum value to enforce for new documents. + final int? max; - /// Default value for column when not provided. Cannot be set when column is required. - final int? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final int? xdefault; - ColumnBigint({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + ColumnBigint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory ColumnBigint.fromMap(Map map) { - return ColumnBigint( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min'], - max: map['max'], - xdefault: map['default'], - ); - } + factory ColumnBigint.fromMap(Map map) { + return ColumnBigint( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_boolean.dart b/lib/src/models/column_boolean.dart index 17a41b53..09aaf59d 100644 --- a/lib/src/models/column_boolean.dart +++ b/lib/src/models/column_boolean.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// ColumnBoolean class ColumnBoolean implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final bool? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final bool? xdefault; - ColumnBoolean({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnBoolean({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnBoolean.fromMap(Map map) { - return ColumnBoolean( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default'], - ); - } + factory ColumnBoolean.fromMap(Map map) { + return ColumnBoolean( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_datetime.dart b/lib/src/models/column_datetime.dart index b75741f9..dd347a8f 100644 --- a/lib/src/models/column_datetime.dart +++ b/lib/src/models/column_datetime.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnDatetime class ColumnDatetime implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// ISO 8601 format. - final String format; + /// ISO 8601 format. + final String format; - /// Default value for column when not provided. Only null is optional - final String? xdefault; + /// Default value for column when not provided. Only null is optional + final String? xdefault; - ColumnDatetime({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnDatetime({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnDatetime.fromMap(Map map) { - return ColumnDatetime( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnDatetime.fromMap(Map map) { + return ColumnDatetime( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_email.dart b/lib/src/models/column_email.dart index 9103b043..24bc025d 100644 --- a/lib/src/models/column_email.dart +++ b/lib/src/models/column_email.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnEmail class ColumnEmail implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnEmail({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnEmail({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnEmail.fromMap(Map map) { - return ColumnEmail( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnEmail.fromMap(Map map) { + return ColumnEmail( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_enum.dart b/lib/src/models/column_enum.dart index 0eae5565..0138a664 100644 --- a/lib/src/models/column_enum.dart +++ b/lib/src/models/column_enum.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// ColumnEnum class ColumnEnum implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Array of elements in enumerated type. - final List elements; + /// Array of elements in enumerated type. + final List elements; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnEnum({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.elements, - required this.format, - this.xdefault, - }); + ColumnEnum({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.elements, + required this.format, + this.xdefault, + }); - factory ColumnEnum.fromMap(Map map) { - return ColumnEnum( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - elements: List.from(map['elements'] ?? []), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnEnum.fromMap(Map map) { + return ColumnEnum( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + elements: List.from(map['elements'] ?? []), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "elements": elements, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "elements": elements, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_float.dart b/lib/src/models/column_float.dart index 499fb886..63dc80c6 100644 --- a/lib/src/models/column_float.dart +++ b/lib/src/models/column_float.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// ColumnFloat class ColumnFloat implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final double? min; + /// Minimum value to enforce for new documents. + final double? min; - /// Maximum value to enforce for new documents. - final double? max; + /// Maximum value to enforce for new documents. + final double? max; - /// Default value for column when not provided. Cannot be set when column is required. - final double? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final double? xdefault; - ColumnFloat({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + ColumnFloat({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory ColumnFloat.fromMap(Map map) { - return ColumnFloat( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min']?.toDouble(), - max: map['max']?.toDouble(), - xdefault: map['default']?.toDouble(), - ); - } + factory ColumnFloat.fromMap(Map map) { + return ColumnFloat( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min']?.toDouble(), + max: map['max']?.toDouble(), + xdefault: map['default']?.toDouble(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_index.dart b/lib/src/models/column_index.dart index 24202a9a..3bc4f883 100644 --- a/lib/src/models/column_index.dart +++ b/lib/src/models/column_index.dart @@ -2,77 +2,77 @@ part of '../../models.dart'; /// Index class ColumnIndex implements Model { - /// Index ID. - final String $id; + /// Index ID. + final String $id; - /// Index creation date in ISO 8601 format. - final String $createdAt; + /// Index creation date in ISO 8601 format. + final String $createdAt; - /// Index update date in ISO 8601 format. - final String $updatedAt; + /// Index update date in ISO 8601 format. + final String $updatedAt; - /// Index Key. - final String key; + /// Index Key. + final String key; - /// Index type. - final String type; + /// Index type. + final String type; - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final String status; + /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final String status; - /// Error message. Displays error generated on failure of creating or deleting an index. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an index. + final String error; - /// Index columns. - final List columns; + /// Index columns. + final List columns; - /// Index columns length. - final List lengths; + /// Index columns length. + final List lengths; - /// Index orders. - final List? orders; + /// Index orders. + final List? orders; - ColumnIndex({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.key, - required this.type, - required this.status, - required this.error, - required this.columns, - required this.lengths, - this.orders, - }); + ColumnIndex({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.key, + required this.type, + required this.status, + required this.error, + required this.columns, + required this.lengths, + this.orders, + }); - factory ColumnIndex.fromMap(Map map) { - return ColumnIndex( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - key: map['key'].toString(), - type: map['type'].toString(), - status: map['status'].toString(), - error: map['error'].toString(), - columns: List.from(map['columns'] ?? []), - lengths: List.from(map['lengths'] ?? []), - orders: List.from(map['orders'] ?? []), - ); - } + factory ColumnIndex.fromMap(Map map) { + return ColumnIndex( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + key: map['key'].toString(), + type: map['type'].toString(), + status: map['status'].toString(), + error: map['error'].toString(), + columns: List.from(map['columns'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status, - "error": error, - "columns": columns, - "lengths": lengths, - "orders": orders, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status, + "error": error, + "columns": columns, + "lengths": lengths, + "orders": orders, + }; + } } diff --git a/lib/src/models/column_index_list.dart b/lib/src/models/column_index_list.dart index 146ecf21..7d7d2fd4 100644 --- a/lib/src/models/column_index_list.dart +++ b/lib/src/models/column_index_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Column Indexes List class ColumnIndexList implements Model { - /// Total number of indexes that matched your query. - final int total; + /// Total number of indexes that matched your query. + final int total; - /// List of indexes. - final List indexes; + /// List of indexes. + final List indexes; - ColumnIndexList({ - required this.total, - required this.indexes, - }); + ColumnIndexList({ + required this.total, + required this.indexes, + }); - factory ColumnIndexList.fromMap(Map map) { - return ColumnIndexList( - total: map['total'], - indexes: List.from(map['indexes'].map((p) => ColumnIndex.fromMap(p))), - ); - } + factory ColumnIndexList.fromMap(Map map) { + return ColumnIndexList( + total: map['total'], + indexes: List.from( + map['indexes'].map((p) => ColumnIndex.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "indexes": indexes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/column_integer.dart b/lib/src/models/column_integer.dart index 9d166622..0e71ba39 100644 --- a/lib/src/models/column_integer.dart +++ b/lib/src/models/column_integer.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// ColumnInteger class ColumnInteger implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Minimum value to enforce for new documents. - final int? min; + /// Minimum value to enforce for new documents. + final int? min; - /// Maximum value to enforce for new documents. - final int? max; + /// Maximum value to enforce for new documents. + final int? max; - /// Default value for column when not provided. Cannot be set when column is required. - final int? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final int? xdefault; - ColumnInteger({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.min, - this.max, - this.xdefault, - }); + ColumnInteger({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.min, + this.max, + this.xdefault, + }); - factory ColumnInteger.fromMap(Map map) { - return ColumnInteger( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - min: map['min'], - max: map['max'], - xdefault: map['default'], - ); - } + factory ColumnInteger.fromMap(Map map) { + return ColumnInteger( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + min: map['min'], + max: map['max'], + xdefault: map['default'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "min": min, - "max": max, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "min": min, + "max": max, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_ip.dart b/lib/src/models/column_ip.dart index d9863c3a..2e896eb7 100644 --- a/lib/src/models/column_ip.dart +++ b/lib/src/models/column_ip.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnIP class ColumnIp implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnIp({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnIp({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnIp.fromMap(Map map) { - return ColumnIp( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnIp.fromMap(Map map) { + return ColumnIp( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_line.dart b/lib/src/models/column_line.dart index 12a081ef..9832b853 100644 --- a/lib/src/models/column_line.dart +++ b/lib/src/models/column_line.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// ColumnLine class ColumnLine implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final List? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final List? xdefault; - ColumnLine({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnLine({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnLine.fromMap(Map map) { - return ColumnLine( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory ColumnLine.fromMap(Map map) { + return ColumnLine( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_list.dart b/lib/src/models/column_list.dart index fc3e265e..548c1d4a 100644 --- a/lib/src/models/column_list.dart +++ b/lib/src/models/column_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Columns List class ColumnList implements Model { - /// Total number of columns in the given table. - final int total; + /// Total number of columns in the given table. + final int total; - /// List of columns. - final List columns; + /// List of columns. + final List columns; - ColumnList({ - required this.total, - required this.columns, - }); + ColumnList({ + required this.total, + required this.columns, + }); - factory ColumnList.fromMap(Map map) { - return ColumnList( - total: map['total'], - columns: List.from(map['columns'] ?? []), - ); - } + factory ColumnList.fromMap(Map map) { + return ColumnList( + total: map['total'], + columns: List.from(map['columns'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "columns": columns, - }; - } + @override + Map toMap() { + return { + "total": total, + "columns": columns, + }; + } } diff --git a/lib/src/models/column_longtext.dart b/lib/src/models/column_longtext.dart index 397a0eb7..7d9d87ed 100644 --- a/lib/src/models/column_longtext.dart +++ b/lib/src/models/column_longtext.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnLongtext class ColumnLongtext implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnLongtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + ColumnLongtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory ColumnLongtext.fromMap(Map map) { - return ColumnLongtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnLongtext.fromMap(Map map) { + return ColumnLongtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_mediumtext.dart b/lib/src/models/column_mediumtext.dart index 47134b91..326176ea 100644 --- a/lib/src/models/column_mediumtext.dart +++ b/lib/src/models/column_mediumtext.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnMediumtext class ColumnMediumtext implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnMediumtext({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + ColumnMediumtext({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory ColumnMediumtext.fromMap(Map map) { - return ColumnMediumtext( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnMediumtext.fromMap(Map map) { + return ColumnMediumtext( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_point.dart b/lib/src/models/column_point.dart index d84da2b3..7b6ce167 100644 --- a/lib/src/models/column_point.dart +++ b/lib/src/models/column_point.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// ColumnPoint class ColumnPoint implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final List? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final List? xdefault; - ColumnPoint({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnPoint({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnPoint.fromMap(Map map) { - return ColumnPoint( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory ColumnPoint.fromMap(Map map) { + return ColumnPoint( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_polygon.dart b/lib/src/models/column_polygon.dart index 0e469c20..97d7ee80 100644 --- a/lib/src/models/column_polygon.dart +++ b/lib/src/models/column_polygon.dart @@ -2,71 +2,72 @@ part of '../../models.dart'; /// ColumnPolygon class ColumnPolygon implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final List? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final List? xdefault; - ColumnPolygon({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - }); + ColumnPolygon({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + }); - factory ColumnPolygon.fromMap(Map map) { - return ColumnPolygon( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: List.from(map['default'] ?? []), - ); - } + factory ColumnPolygon.fromMap(Map map) { + return ColumnPolygon( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: List.from(map['default'] ?? []), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_relationship.dart b/lib/src/models/column_relationship.dart index 68b6f013..cf48ef07 100644 --- a/lib/src/models/column_relationship.dart +++ b/lib/src/models/column_relationship.dart @@ -2,101 +2,102 @@ part of '../../models.dart'; /// ColumnRelationship class ColumnRelationship implements Model { - /// Column Key. - final String key; - - /// Column type. - final String type; - - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; - - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; - - /// Is column required? - final bool xrequired; - - /// Is column an array? - final bool? array; - - /// Column creation date in ISO 8601 format. - final String $createdAt; - - /// Column update date in ISO 8601 format. - final String $updatedAt; - - /// The ID of the related table. - final String relatedTable; - - /// The type of the relationship. - final String relationType; - - /// Is the relationship two-way? - final bool twoWay; - - /// The key of the two-way relationship. - final String twoWayKey; - - /// How deleting the parent document will propagate to child documents. - final String onDelete; - - /// Whether this is the parent or child side of the relationship - final String side; - - ColumnRelationship({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.relatedTable, - required this.relationType, - required this.twoWay, - required this.twoWayKey, - required this.onDelete, - required this.side, - }); - - factory ColumnRelationship.fromMap(Map map) { - return ColumnRelationship( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - relatedTable: map['relatedTable'].toString(), - relationType: map['relationType'].toString(), - twoWay: map['twoWay'], - twoWayKey: map['twoWayKey'].toString(), - onDelete: map['onDelete'].toString(), - side: map['side'].toString(), - ); - } - - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "relatedTable": relatedTable, - "relationType": relationType, - "twoWay": twoWay, - "twoWayKey": twoWayKey, - "onDelete": onDelete, - "side": side, - }; - } + /// Column Key. + final String key; + + /// Column type. + final String type; + + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; + + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; + + /// Is column required? + final bool xrequired; + + /// Is column an array? + final bool? array; + + /// Column creation date in ISO 8601 format. + final String $createdAt; + + /// Column update date in ISO 8601 format. + final String $updatedAt; + + /// The ID of the related table. + final String relatedTable; + + /// The type of the relationship. + final String relationType; + + /// Is the relationship two-way? + final bool twoWay; + + /// The key of the two-way relationship. + final String twoWayKey; + + /// How deleting the parent document will propagate to child documents. + final String onDelete; + + /// Whether this is the parent or child side of the relationship + final String side; + + ColumnRelationship({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.relatedTable, + required this.relationType, + required this.twoWay, + required this.twoWayKey, + required this.onDelete, + required this.side, + }); + + factory ColumnRelationship.fromMap(Map map) { + return ColumnRelationship( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + relatedTable: map['relatedTable'].toString(), + relationType: map['relationType'].toString(), + twoWay: map['twoWay'], + twoWayKey: map['twoWayKey'].toString(), + onDelete: map['onDelete'].toString(), + side: map['side'].toString(), + ); + } + + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "relatedTable": relatedTable, + "relationType": relationType, + "twoWay": twoWay, + "twoWayKey": twoWayKey, + "onDelete": onDelete, + "side": side, + }; + } } diff --git a/lib/src/models/column_string.dart b/lib/src/models/column_string.dart index 9d687480..a0feb3fd 100644 --- a/lib/src/models/column_string.dart +++ b/lib/src/models/column_string.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// ColumnString class ColumnString implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Column size. - final int size; + /// Column size. + final int size; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnString({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + ColumnString({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory ColumnString.fromMap(Map map) { - return ColumnString( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnString.fromMap(Map map) { + return ColumnString( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_text.dart b/lib/src/models/column_text.dart index 27a35251..51eb10ee 100644 --- a/lib/src/models/column_text.dart +++ b/lib/src/models/column_text.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnText class ColumnText implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnText({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - this.xdefault, - this.encrypt, - }); + ColumnText({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + this.xdefault, + this.encrypt, + }); - factory ColumnText.fromMap(Map map) { - return ColumnText( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnText.fromMap(Map map) { + return ColumnText( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/column_url.dart b/lib/src/models/column_url.dart index d2faf233..b6eb4254 100644 --- a/lib/src/models/column_url.dart +++ b/lib/src/models/column_url.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// ColumnURL class ColumnUrl implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// String format. - final String format; + /// String format. + final String format; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - ColumnUrl({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.format, - this.xdefault, - }); + ColumnUrl({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.format, + this.xdefault, + }); - factory ColumnUrl.fromMap(Map map) { - return ColumnUrl( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - format: map['format'].toString(), - xdefault: map['default']?.toString(), - ); - } + factory ColumnUrl.fromMap(Map map) { + return ColumnUrl( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + format: map['format'].toString(), + xdefault: map['default']?.toString(), + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "format": format, - "default": xdefault, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "format": format, + "default": xdefault, + }; + } } diff --git a/lib/src/models/column_varchar.dart b/lib/src/models/column_varchar.dart index 5540e0fb..2a6cf042 100644 --- a/lib/src/models/column_varchar.dart +++ b/lib/src/models/column_varchar.dart @@ -2,83 +2,84 @@ part of '../../models.dart'; /// ColumnVarchar class ColumnVarchar implements Model { - /// Column Key. - final String key; + /// Column Key. + final String key; - /// Column type. - final String type; + /// Column type. + final String type; - /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.ColumnStatus status; + /// Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.ColumnStatus status; - /// Error message. Displays error generated on failure of creating or deleting an column. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an column. + final String error; - /// Is column required? - final bool xrequired; + /// Is column required? + final bool xrequired; - /// Is column an array? - final bool? array; + /// Is column an array? + final bool? array; - /// Column creation date in ISO 8601 format. - final String $createdAt; + /// Column creation date in ISO 8601 format. + final String $createdAt; - /// Column update date in ISO 8601 format. - final String $updatedAt; + /// Column update date in ISO 8601 format. + final String $updatedAt; - /// Column size. - final int size; + /// Column size. + final int size; - /// Default value for column when not provided. Cannot be set when column is required. - final String? xdefault; + /// Default value for column when not provided. Cannot be set when column is required. + final String? xdefault; - /// Defines whether this column is encrypted or not. - final bool? encrypt; + /// Defines whether this column is encrypted or not. + final bool? encrypt; - ColumnVarchar({ - required this.key, - required this.type, - required this.status, - required this.error, - required this.xrequired, - this.array, - required this.$createdAt, - required this.$updatedAt, - required this.size, - this.xdefault, - this.encrypt, - }); + ColumnVarchar({ + required this.key, + required this.type, + required this.status, + required this.error, + required this.xrequired, + this.array, + required this.$createdAt, + required this.$updatedAt, + required this.size, + this.xdefault, + this.encrypt, + }); - factory ColumnVarchar.fromMap(Map map) { - return ColumnVarchar( - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - xrequired: map['required'], - array: map['array'], - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - size: map['size'], - xdefault: map['default']?.toString(), - encrypt: map['encrypt'], - ); - } + factory ColumnVarchar.fromMap(Map map) { + return ColumnVarchar( + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.ColumnStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + xrequired: map['required'], + array: map['array'], + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + size: map['size'], + xdefault: map['default']?.toString(), + encrypt: map['encrypt'], + ); + } - @override - Map toMap() { - return { - "key": key, - "type": type, - "status": status.value, - "error": error, - "required": xrequired, - "array": array, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "size": size, - "default": xdefault, - "encrypt": encrypt, - }; - } + @override + Map toMap() { + return { + "key": key, + "type": type, + "status": status.value, + "error": error, + "required": xrequired, + "array": array, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "size": size, + "default": xdefault, + "encrypt": encrypt, + }; + } } diff --git a/lib/src/models/continent.dart b/lib/src/models/continent.dart index 930900bf..ec3c41be 100644 --- a/lib/src/models/continent.dart +++ b/lib/src/models/continent.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Continent class Continent implements Model { - /// Continent name. - final String name; + /// Continent name. + final String name; - /// Continent two letter code. - final String code; + /// Continent two letter code. + final String code; - Continent({ - required this.name, - required this.code, - }); + Continent({ + required this.name, + required this.code, + }); - factory Continent.fromMap(Map map) { - return Continent( - name: map['name'].toString(), - code: map['code'].toString(), - ); - } + factory Continent.fromMap(Map map) { + return Continent( + name: map['name'].toString(), + code: map['code'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "code": code, - }; - } + @override + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/continent_list.dart b/lib/src/models/continent_list.dart index 753bcacc..df28f04b 100644 --- a/lib/src/models/continent_list.dart +++ b/lib/src/models/continent_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Continents List class ContinentList implements Model { - /// Total number of continents that matched your query. - final int total; + /// Total number of continents that matched your query. + final int total; - /// List of continents. - final List continents; + /// List of continents. + final List continents; - ContinentList({ - required this.total, - required this.continents, - }); + ContinentList({ + required this.total, + required this.continents, + }); - factory ContinentList.fromMap(Map map) { - return ContinentList( - total: map['total'], - continents: List.from(map['continents'].map((p) => Continent.fromMap(p))), - ); - } + factory ContinentList.fromMap(Map map) { + return ContinentList( + total: map['total'], + continents: List.from( + map['continents'].map((p) => Continent.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "continents": continents.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "continents": continents.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/country.dart b/lib/src/models/country.dart index c4838ba3..3bcbb76d 100644 --- a/lib/src/models/country.dart +++ b/lib/src/models/country.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Country class Country implements Model { - /// Country name. - final String name; + /// Country name. + final String name; - /// Country two-character ISO 3166-1 alpha code. - final String code; + /// Country two-character ISO 3166-1 alpha code. + final String code; - Country({ - required this.name, - required this.code, - }); + Country({ + required this.name, + required this.code, + }); - factory Country.fromMap(Map map) { - return Country( - name: map['name'].toString(), - code: map['code'].toString(), - ); - } + factory Country.fromMap(Map map) { + return Country( + name: map['name'].toString(), + code: map['code'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "code": code, - }; - } + @override + Map toMap() { + return { + "name": name, + "code": code, + }; + } } diff --git a/lib/src/models/country_list.dart b/lib/src/models/country_list.dart index f363a54b..79cb1256 100644 --- a/lib/src/models/country_list.dart +++ b/lib/src/models/country_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Countries List class CountryList implements Model { - /// Total number of countries that matched your query. - final int total; + /// Total number of countries that matched your query. + final int total; - /// List of countries. - final List countries; + /// List of countries. + final List countries; - CountryList({ - required this.total, - required this.countries, - }); + CountryList({ + required this.total, + required this.countries, + }); - factory CountryList.fromMap(Map map) { - return CountryList( - total: map['total'], - countries: List.from(map['countries'].map((p) => Country.fromMap(p))), - ); - } + factory CountryList.fromMap(Map map) { + return CountryList( + total: map['total'], + countries: + List.from(map['countries'].map((p) => Country.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "countries": countries.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "countries": countries.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/currency.dart b/lib/src/models/currency.dart index b6bb455f..f2b18093 100644 --- a/lib/src/models/currency.dart +++ b/lib/src/models/currency.dart @@ -2,59 +2,59 @@ part of '../../models.dart'; /// Currency class Currency implements Model { - /// Currency symbol. - final String symbol; - - /// Currency name. - final String name; - - /// Currency native symbol. - final String symbolNative; - - /// Number of decimal digits. - final int decimalDigits; - - /// Currency digit rounding. - final double rounding; - - /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. - final String code; - - /// Currency plural name - final String namePlural; - - Currency({ - required this.symbol, - required this.name, - required this.symbolNative, - required this.decimalDigits, - required this.rounding, - required this.code, - required this.namePlural, - }); - - factory Currency.fromMap(Map map) { - return Currency( - symbol: map['symbol'].toString(), - name: map['name'].toString(), - symbolNative: map['symbolNative'].toString(), - decimalDigits: map['decimalDigits'], - rounding: map['rounding'].toDouble(), - code: map['code'].toString(), - namePlural: map['namePlural'].toString(), - ); - } - - @override - Map toMap() { - return { - "symbol": symbol, - "name": name, - "symbolNative": symbolNative, - "decimalDigits": decimalDigits, - "rounding": rounding, - "code": code, - "namePlural": namePlural, - }; - } + /// Currency symbol. + final String symbol; + + /// Currency name. + final String name; + + /// Currency native symbol. + final String symbolNative; + + /// Number of decimal digits. + final int decimalDigits; + + /// Currency digit rounding. + final double rounding; + + /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + final String code; + + /// Currency plural name + final String namePlural; + + Currency({ + required this.symbol, + required this.name, + required this.symbolNative, + required this.decimalDigits, + required this.rounding, + required this.code, + required this.namePlural, + }); + + factory Currency.fromMap(Map map) { + return Currency( + symbol: map['symbol'].toString(), + name: map['name'].toString(), + symbolNative: map['symbolNative'].toString(), + decimalDigits: map['decimalDigits'], + rounding: map['rounding'].toDouble(), + code: map['code'].toString(), + namePlural: map['namePlural'].toString(), + ); + } + + @override + Map toMap() { + return { + "symbol": symbol, + "name": name, + "symbolNative": symbolNative, + "decimalDigits": decimalDigits, + "rounding": rounding, + "code": code, + "namePlural": namePlural, + }; + } } diff --git a/lib/src/models/currency_list.dart b/lib/src/models/currency_list.dart index eb2bad19..6c39ae2e 100644 --- a/lib/src/models/currency_list.dart +++ b/lib/src/models/currency_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Currencies List class CurrencyList implements Model { - /// Total number of currencies that matched your query. - final int total; + /// Total number of currencies that matched your query. + final int total; - /// List of currencies. - final List currencies; + /// List of currencies. + final List currencies; - CurrencyList({ - required this.total, - required this.currencies, - }); + CurrencyList({ + required this.total, + required this.currencies, + }); - factory CurrencyList.fromMap(Map map) { - return CurrencyList( - total: map['total'], - currencies: List.from(map['currencies'].map((p) => Currency.fromMap(p))), - ); - } + factory CurrencyList.fromMap(Map map) { + return CurrencyList( + total: map['total'], + currencies: List.from( + map['currencies'].map((p) => Currency.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "currencies": currencies.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "currencies": currencies.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/database.dart b/lib/src/models/database.dart index a40496ea..432d94b2 100644 --- a/lib/src/models/database.dart +++ b/lib/src/models/database.dart @@ -2,65 +2,66 @@ part of '../../models.dart'; /// Database class Database implements Model { - /// Database ID. - final String $id; + /// Database ID. + final String $id; - /// Database name. - final String name; + /// Database name. + final String name; - /// Database creation date in ISO 8601 format. - final String $createdAt; + /// Database creation date in ISO 8601 format. + final String $createdAt; - /// Database update date in ISO 8601 format. - final String $updatedAt; + /// Database update date in ISO 8601 format. + final String $updatedAt; - /// If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. - final bool enabled; + /// If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. + final bool enabled; - /// Database type. - final enums.DatabaseType type; + /// Database type. + final enums.DatabaseType type; - /// Database backup policies. - final List policies; + /// Database backup policies. + final List policies; - /// Database backup archives. - final List archives; + /// Database backup archives. + final List archives; - Database({ - required this.$id, - required this.name, - required this.$createdAt, - required this.$updatedAt, - required this.enabled, - required this.type, - required this.policies, - required this.archives, - }); + Database({ + required this.$id, + required this.name, + required this.$createdAt, + required this.$updatedAt, + required this.enabled, + required this.type, + required this.policies, + required this.archives, + }); - factory Database.fromMap(Map map) { - return Database( - $id: map['\$id'].toString(), - name: map['name'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - enabled: map['enabled'], - type: enums.DatabaseType.values.firstWhere((e) => e.value == map['type']), - policies: List.from(map['policies'].map((p) => Index.fromMap(p))), - archives: List.from(map['archives'].map((p) => Collection.fromMap(p))), - ); - } + factory Database.fromMap(Map map) { + return Database( + $id: map['\$id'].toString(), + name: map['name'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + enabled: map['enabled'], + type: enums.DatabaseType.values.firstWhere((e) => e.value == map['type']), + policies: List.from(map['policies'].map((p) => Index.fromMap(p))), + archives: List.from( + map['archives'].map((p) => Collection.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "name": name, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "enabled": enabled, - "type": type.value, - "policies": policies.map((p) => p.toMap()).toList(), - "archives": archives.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "name": name, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "enabled": enabled, + "type": type.value, + "policies": policies.map((p) => p.toMap()).toList(), + "archives": archives.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/database_list.dart b/lib/src/models/database_list.dart index dc6c7f62..1af1b466 100644 --- a/lib/src/models/database_list.dart +++ b/lib/src/models/database_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Databases List class DatabaseList implements Model { - /// Total number of databases that matched your query. - final int total; + /// Total number of databases that matched your query. + final int total; - /// List of databases. - final List databases; + /// List of databases. + final List databases; - DatabaseList({ - required this.total, - required this.databases, - }); + DatabaseList({ + required this.total, + required this.databases, + }); - factory DatabaseList.fromMap(Map map) { - return DatabaseList( - total: map['total'], - databases: List.from(map['databases'].map((p) => Database.fromMap(p))), - ); - } + factory DatabaseList.fromMap(Map map) { + return DatabaseList( + total: map['total'], + databases: + List.from(map['databases'].map((p) => Database.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "databases": databases.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "databases": databases.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/deployment.dart b/lib/src/models/deployment.dart index 901361ea..dec00090 100644 --- a/lib/src/models/deployment.dart +++ b/lib/src/models/deployment.dart @@ -2,179 +2,180 @@ part of '../../models.dart'; /// Deployment class Deployment implements Model { - /// Deployment ID. - final String $id; + /// Deployment ID. + final String $id; - /// Deployment creation date in ISO 8601 format. - final String $createdAt; + /// Deployment creation date in ISO 8601 format. + final String $createdAt; - /// Deployment update date in ISO 8601 format. - final String $updatedAt; + /// Deployment update date in ISO 8601 format. + final String $updatedAt; - /// Type of deployment. - final String type; + /// Type of deployment. + final String type; - /// Resource ID. - final String resourceId; + /// Resource ID. + final String resourceId; - /// Resource type. - final String resourceType; - - /// The entrypoint file to use to execute the deployment code. - final String entrypoint; - - /// The code size in bytes. - final int sourceSize; - - /// The build output size in bytes. - final int buildSize; - - /// The total size in bytes (source and build output). - final int totalSize; - - /// The current build ID. - final String buildId; - - /// Whether the deployment should be automatically activated. - final bool activate; - - /// Screenshot with light theme preference file ID. - final String screenshotLight; - - /// Screenshot with dark theme preference file ID. - final String screenshotDark; - - /// The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". - final enums.DeploymentStatus status; - - /// The build logs. - final String buildLogs; - - /// The current build time in seconds. - final int buildDuration; - - /// The name of the vcs provider repository - final String providerRepositoryName; - - /// The name of the vcs provider repository owner - final String providerRepositoryOwner; - - /// The url of the vcs provider repository - final String providerRepositoryUrl; - - /// The commit hash of the vcs commit - final String providerCommitHash; - - /// The url of vcs commit author - final String providerCommitAuthorUrl; - - /// The name of vcs commit author - final String providerCommitAuthor; - - /// The commit message - final String providerCommitMessage; - - /// The url of the vcs commit - final String providerCommitUrl; - - /// The branch of the vcs repository - final String providerBranch; - - /// The branch of the vcs repository - final String providerBranchUrl; - - Deployment({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.type, - required this.resourceId, - required this.resourceType, - required this.entrypoint, - required this.sourceSize, - required this.buildSize, - required this.totalSize, - required this.buildId, - required this.activate, - required this.screenshotLight, - required this.screenshotDark, - required this.status, - required this.buildLogs, - required this.buildDuration, - required this.providerRepositoryName, - required this.providerRepositoryOwner, - required this.providerRepositoryUrl, - required this.providerCommitHash, - required this.providerCommitAuthorUrl, - required this.providerCommitAuthor, - required this.providerCommitMessage, - required this.providerCommitUrl, - required this.providerBranch, - required this.providerBranchUrl, - }); - - factory Deployment.fromMap(Map map) { - return Deployment( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - type: map['type'].toString(), - resourceId: map['resourceId'].toString(), - resourceType: map['resourceType'].toString(), - entrypoint: map['entrypoint'].toString(), - sourceSize: map['sourceSize'], - buildSize: map['buildSize'], - totalSize: map['totalSize'], - buildId: map['buildId'].toString(), - activate: map['activate'], - screenshotLight: map['screenshotLight'].toString(), - screenshotDark: map['screenshotDark'].toString(), - status: enums.DeploymentStatus.values.firstWhere((e) => e.value == map['status']), - buildLogs: map['buildLogs'].toString(), - buildDuration: map['buildDuration'], - providerRepositoryName: map['providerRepositoryName'].toString(), - providerRepositoryOwner: map['providerRepositoryOwner'].toString(), - providerRepositoryUrl: map['providerRepositoryUrl'].toString(), - providerCommitHash: map['providerCommitHash'].toString(), - providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), - providerCommitAuthor: map['providerCommitAuthor'].toString(), - providerCommitMessage: map['providerCommitMessage'].toString(), - providerCommitUrl: map['providerCommitUrl'].toString(), - providerBranch: map['providerBranch'].toString(), - providerBranchUrl: map['providerBranchUrl'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "type": type, - "resourceId": resourceId, - "resourceType": resourceType, - "entrypoint": entrypoint, - "sourceSize": sourceSize, - "buildSize": buildSize, - "totalSize": totalSize, - "buildId": buildId, - "activate": activate, - "screenshotLight": screenshotLight, - "screenshotDark": screenshotDark, - "status": status.value, - "buildLogs": buildLogs, - "buildDuration": buildDuration, - "providerRepositoryName": providerRepositoryName, - "providerRepositoryOwner": providerRepositoryOwner, - "providerRepositoryUrl": providerRepositoryUrl, - "providerCommitHash": providerCommitHash, - "providerCommitAuthorUrl": providerCommitAuthorUrl, - "providerCommitAuthor": providerCommitAuthor, - "providerCommitMessage": providerCommitMessage, - "providerCommitUrl": providerCommitUrl, - "providerBranch": providerBranch, - "providerBranchUrl": providerBranchUrl, - }; - } + /// Resource type. + final String resourceType; + + /// The entrypoint file to use to execute the deployment code. + final String entrypoint; + + /// The code size in bytes. + final int sourceSize; + + /// The build output size in bytes. + final int buildSize; + + /// The total size in bytes (source and build output). + final int totalSize; + + /// The current build ID. + final String buildId; + + /// Whether the deployment should be automatically activated. + final bool activate; + + /// Screenshot with light theme preference file ID. + final String screenshotLight; + + /// Screenshot with dark theme preference file ID. + final String screenshotDark; + + /// The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". + final enums.DeploymentStatus status; + + /// The build logs. + final String buildLogs; + + /// The current build time in seconds. + final int buildDuration; + + /// The name of the vcs provider repository + final String providerRepositoryName; + + /// The name of the vcs provider repository owner + final String providerRepositoryOwner; + + /// The url of the vcs provider repository + final String providerRepositoryUrl; + + /// The commit hash of the vcs commit + final String providerCommitHash; + + /// The url of vcs commit author + final String providerCommitAuthorUrl; + + /// The name of vcs commit author + final String providerCommitAuthor; + + /// The commit message + final String providerCommitMessage; + + /// The url of the vcs commit + final String providerCommitUrl; + + /// The branch of the vcs repository + final String providerBranch; + + /// The branch of the vcs repository + final String providerBranchUrl; + + Deployment({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.type, + required this.resourceId, + required this.resourceType, + required this.entrypoint, + required this.sourceSize, + required this.buildSize, + required this.totalSize, + required this.buildId, + required this.activate, + required this.screenshotLight, + required this.screenshotDark, + required this.status, + required this.buildLogs, + required this.buildDuration, + required this.providerRepositoryName, + required this.providerRepositoryOwner, + required this.providerRepositoryUrl, + required this.providerCommitHash, + required this.providerCommitAuthorUrl, + required this.providerCommitAuthor, + required this.providerCommitMessage, + required this.providerCommitUrl, + required this.providerBranch, + required this.providerBranchUrl, + }); + + factory Deployment.fromMap(Map map) { + return Deployment( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + type: map['type'].toString(), + resourceId: map['resourceId'].toString(), + resourceType: map['resourceType'].toString(), + entrypoint: map['entrypoint'].toString(), + sourceSize: map['sourceSize'], + buildSize: map['buildSize'], + totalSize: map['totalSize'], + buildId: map['buildId'].toString(), + activate: map['activate'], + screenshotLight: map['screenshotLight'].toString(), + screenshotDark: map['screenshotDark'].toString(), + status: enums.DeploymentStatus.values + .firstWhere((e) => e.value == map['status']), + buildLogs: map['buildLogs'].toString(), + buildDuration: map['buildDuration'], + providerRepositoryName: map['providerRepositoryName'].toString(), + providerRepositoryOwner: map['providerRepositoryOwner'].toString(), + providerRepositoryUrl: map['providerRepositoryUrl'].toString(), + providerCommitHash: map['providerCommitHash'].toString(), + providerCommitAuthorUrl: map['providerCommitAuthorUrl'].toString(), + providerCommitAuthor: map['providerCommitAuthor'].toString(), + providerCommitMessage: map['providerCommitMessage'].toString(), + providerCommitUrl: map['providerCommitUrl'].toString(), + providerBranch: map['providerBranch'].toString(), + providerBranchUrl: map['providerBranchUrl'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "type": type, + "resourceId": resourceId, + "resourceType": resourceType, + "entrypoint": entrypoint, + "sourceSize": sourceSize, + "buildSize": buildSize, + "totalSize": totalSize, + "buildId": buildId, + "activate": activate, + "screenshotLight": screenshotLight, + "screenshotDark": screenshotDark, + "status": status.value, + "buildLogs": buildLogs, + "buildDuration": buildDuration, + "providerRepositoryName": providerRepositoryName, + "providerRepositoryOwner": providerRepositoryOwner, + "providerRepositoryUrl": providerRepositoryUrl, + "providerCommitHash": providerCommitHash, + "providerCommitAuthorUrl": providerCommitAuthorUrl, + "providerCommitAuthor": providerCommitAuthor, + "providerCommitMessage": providerCommitMessage, + "providerCommitUrl": providerCommitUrl, + "providerBranch": providerBranch, + "providerBranchUrl": providerBranchUrl, + }; + } } diff --git a/lib/src/models/deployment_list.dart b/lib/src/models/deployment_list.dart index 57789751..38dfc9b7 100644 --- a/lib/src/models/deployment_list.dart +++ b/lib/src/models/deployment_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Deployments List class DeploymentList implements Model { - /// Total number of deployments that matched your query. - final int total; + /// Total number of deployments that matched your query. + final int total; - /// List of deployments. - final List deployments; + /// List of deployments. + final List deployments; - DeploymentList({ - required this.total, - required this.deployments, - }); + DeploymentList({ + required this.total, + required this.deployments, + }); - factory DeploymentList.fromMap(Map map) { - return DeploymentList( - total: map['total'], - deployments: List.from(map['deployments'].map((p) => Deployment.fromMap(p))), - ); - } + factory DeploymentList.fromMap(Map map) { + return DeploymentList( + total: map['total'], + deployments: List.from( + map['deployments'].map((p) => Deployment.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "deployments": deployments.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "deployments": deployments.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/dev_key.dart b/lib/src/models/dev_key.dart index b743a031..06f90c5b 100644 --- a/lib/src/models/dev_key.dart +++ b/lib/src/models/dev_key.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// DevKey class DevKey implements Model { - /// Key ID. - final String $id; + /// Key ID. + final String $id; - /// Key creation date in ISO 8601 format. - final String $createdAt; + /// Key creation date in ISO 8601 format. + final String $createdAt; - /// Key update date in ISO 8601 format. - final String $updatedAt; + /// Key update date in ISO 8601 format. + final String $updatedAt; - /// Key name. - final String name; + /// Key name. + final String name; - /// Key expiration date in ISO 8601 format. - final String expire; + /// Key expiration date in ISO 8601 format. + final String expire; - /// Secret key. - final String secret; + /// Secret key. + final String secret; - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; - /// List of SDK user agents that used this key. - final List sdks; + /// List of SDK user agents that used this key. + final List sdks; - DevKey({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.expire, - required this.secret, - required this.accessedAt, - required this.sdks, - }); + DevKey({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.secret, + required this.accessedAt, + required this.sdks, + }); - factory DevKey.fromMap(Map map) { - return DevKey( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - expire: map['expire'].toString(), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - sdks: List.from(map['sdks'] ?? []), - ); - } + factory DevKey.fromMap(Map map) { + return DevKey( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "expire": expire, - "secret": secret, - "accessedAt": accessedAt, - "sdks": sdks, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } } diff --git a/lib/src/models/document.dart b/lib/src/models/document.dart index 0d1fdeb0..be08d599 100644 --- a/lib/src/models/document.dart +++ b/lib/src/models/document.dart @@ -2,66 +2,66 @@ part of '../../models.dart'; /// Document class Document implements Model { - /// Document ID. - final String $id; + /// Document ID. + final String $id; - /// Document sequence ID. - final String $sequence; + /// Document sequence ID. + final String $sequence; - /// Collection ID. - final String $collectionId; + /// Collection ID. + final String $collectionId; - /// Database ID. - final String $databaseId; + /// Database ID. + final String $databaseId; - /// Document creation date in ISO 8601 format. - final String $createdAt; + /// Document creation date in ISO 8601 format. + final String $createdAt; - /// Document update date in ISO 8601 format. - final String $updatedAt; + /// Document update date in ISO 8601 format. + final String $updatedAt; - /// Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - final Map data; + final Map data; - Document({ - required this.$id, - required this.$sequence, - required this.$collectionId, - required this.$databaseId, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.data, - }); + Document({ + required this.$id, + required this.$sequence, + required this.$collectionId, + required this.$databaseId, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.data, + }); - factory Document.fromMap(Map map) { - return Document( - $id: map['\$id'].toString(), - $sequence: map['\$sequence'].toString(), - $collectionId: map['\$collectionId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map["data"] ?? map, - ); - } + factory Document.fromMap(Map map) { + return Document( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $collectionId: map['\$collectionId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$collectionId": $collectionId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$collectionId": $collectionId, + "\$databaseId": $databaseId, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/document_list.dart b/lib/src/models/document_list.dart index 0e30844a..76a07309 100644 --- a/lib/src/models/document_list.dart +++ b/lib/src/models/document_list.dart @@ -2,32 +2,33 @@ part of '../../models.dart'; /// Documents List class DocumentList implements Model { - /// Total number of documents that matched your query. - final int total; + /// Total number of documents that matched your query. + final int total; - /// List of documents. - final List documents; + /// List of documents. + final List documents; - DocumentList({ - required this.total, - required this.documents, - }); + DocumentList({ + required this.total, + required this.documents, + }); - factory DocumentList.fromMap(Map map) { - return DocumentList( - total: map['total'], - documents: List.from(map['documents'].map((p) => Document.fromMap(p))), - ); - } + factory DocumentList.fromMap(Map map) { + return DocumentList( + total: map['total'], + documents: + List.from(map['documents'].map((p) => Document.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "documents": documents.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "documents": documents.map((p) => p.toMap()).toList(), + }; + } - List convertTo(T Function(Map) fromJson) => - documents.map((d) => d.convertTo(fromJson)).toList(); + List convertTo(T Function(Map) fromJson) => + documents.map((d) => d.convertTo(fromJson)).toList(); } diff --git a/lib/src/models/email_template.dart b/lib/src/models/email_template.dart index 2aa13ed3..286d351a 100644 --- a/lib/src/models/email_template.dart +++ b/lib/src/models/email_template.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// EmailTemplate class EmailTemplate implements Model { - /// Template type - final String templateId; + /// Template type + final String templateId; - /// Template locale - final String locale; + /// Template locale + final String locale; - /// Template message - final String message; + /// Template message + final String message; - /// Name of the sender - final String senderName; + /// Name of the sender + final String senderName; - /// Email of the sender - final String senderEmail; + /// Email of the sender + final String senderEmail; - /// Reply to email address - final String replyToEmail; + /// Reply to email address + final String replyToEmail; - /// Reply to name - final String replyToName; + /// Reply to name + final String replyToName; - /// Email subject - final String subject; + /// Email subject + final String subject; - EmailTemplate({ - required this.templateId, - required this.locale, - required this.message, - required this.senderName, - required this.senderEmail, - required this.replyToEmail, - required this.replyToName, - required this.subject, - }); + EmailTemplate({ + required this.templateId, + required this.locale, + required this.message, + required this.senderName, + required this.senderEmail, + required this.replyToEmail, + required this.replyToName, + required this.subject, + }); - factory EmailTemplate.fromMap(Map map) { - return EmailTemplate( - templateId: map['templateId'].toString(), - locale: map['locale'].toString(), - message: map['message'].toString(), - senderName: map['senderName'].toString(), - senderEmail: map['senderEmail'].toString(), - replyToEmail: map['replyToEmail'].toString(), - replyToName: map['replyToName'].toString(), - subject: map['subject'].toString(), - ); - } + factory EmailTemplate.fromMap(Map map) { + return EmailTemplate( + templateId: map['templateId'].toString(), + locale: map['locale'].toString(), + message: map['message'].toString(), + senderName: map['senderName'].toString(), + senderEmail: map['senderEmail'].toString(), + replyToEmail: map['replyToEmail'].toString(), + replyToName: map['replyToName'].toString(), + subject: map['subject'].toString(), + ); + } - @override - Map toMap() { - return { - "templateId": templateId, - "locale": locale, - "message": message, - "senderName": senderName, - "senderEmail": senderEmail, - "replyToEmail": replyToEmail, - "replyToName": replyToName, - "subject": subject, - }; - } + @override + Map toMap() { + return { + "templateId": templateId, + "locale": locale, + "message": message, + "senderName": senderName, + "senderEmail": senderEmail, + "replyToEmail": replyToEmail, + "replyToName": replyToName, + "subject": subject, + }; + } } diff --git a/lib/src/models/email_template_list.dart b/lib/src/models/email_template_list.dart index fd583e50..aef0db58 100644 --- a/lib/src/models/email_template_list.dart +++ b/lib/src/models/email_template_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Email Templates List class EmailTemplateList implements Model { - /// Total number of templates that matched your query. - final int total; + /// Total number of templates that matched your query. + final int total; - /// List of templates. - final List templates; + /// List of templates. + final List templates; - EmailTemplateList({ - required this.total, - required this.templates, - }); + EmailTemplateList({ + required this.total, + required this.templates, + }); - factory EmailTemplateList.fromMap(Map map) { - return EmailTemplateList( - total: map['total'], - templates: List.from(map['templates'].map((p) => EmailTemplate.fromMap(p))), - ); - } + factory EmailTemplateList.fromMap(Map map) { + return EmailTemplateList( + total: map['total'], + templates: List.from( + map['templates'].map((p) => EmailTemplate.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "templates": templates.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "templates": templates.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/ephemeral_key.dart b/lib/src/models/ephemeral_key.dart index 95f0a3a4..899130d7 100644 --- a/lib/src/models/ephemeral_key.dart +++ b/lib/src/models/ephemeral_key.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Ephemeral Key class EphemeralKey implements Model { - /// Key ID. - final String $id; + /// Key ID. + final String $id; - /// Key creation date in ISO 8601 format. - final String $createdAt; + /// Key creation date in ISO 8601 format. + final String $createdAt; - /// Key update date in ISO 8601 format. - final String $updatedAt; + /// Key update date in ISO 8601 format. + final String $updatedAt; - /// Key name. - final String name; + /// Key name. + final String name; - /// Key expiration date in ISO 8601 format. - final String expire; + /// Key expiration date in ISO 8601 format. + final String expire; - /// Allowed permission scopes. - final List scopes; + /// Allowed permission scopes. + final List scopes; - /// Secret key. - final String secret; + /// Secret key. + final String secret; - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; - /// List of SDK user agents that used this key. - final List sdks; + /// List of SDK user agents that used this key. + final List sdks; - EphemeralKey({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.expire, - required this.scopes, - required this.secret, - required this.accessedAt, - required this.sdks, - }); + EphemeralKey({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.scopes, + required this.secret, + required this.accessedAt, + required this.sdks, + }); - factory EphemeralKey.fromMap(Map map) { - return EphemeralKey( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - expire: map['expire'].toString(), - scopes: List.from(map['scopes'] ?? []), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - sdks: List.from(map['sdks'] ?? []), - ); - } + factory EphemeralKey.fromMap(Map map) { + return EphemeralKey( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + scopes: List.from(map['scopes'] ?? []), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "expire": expire, - "scopes": scopes, - "secret": secret, - "accessedAt": accessedAt, - "sdks": sdks, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "scopes": scopes, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } } diff --git a/lib/src/models/execution.dart b/lib/src/models/execution.dart index 3e767ca3..3629e1d6 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -2,125 +2,129 @@ part of '../../models.dart'; /// Execution class Execution implements Model { - /// Execution ID. - final String $id; - - /// Execution creation date in ISO 8601 format. - final String $createdAt; - - /// Execution update date in ISO 8601 format. - final String $updatedAt; - - /// Execution roles. - final List $permissions; - - /// Function ID. - final String functionId; - - /// Function's deployment ID used to create the execution. - final String deploymentId; - - /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - final enums.ExecutionTrigger trigger; - - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. - final enums.ExecutionStatus status; - - /// HTTP request method type. - final String requestMethod; - - /// HTTP request path and query. - final String requestPath; - - /// HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - final List requestHeaders; - - /// HTTP response status code. - final int responseStatusCode; - - /// HTTP response body. This will return empty unless execution is created as synchronous. - final String responseBody; - - /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - final List responseHeaders; - - /// Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - final String logs; - - /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - final String errors; - - /// Resource(function/site) execution duration in seconds. - final double duration; - - /// The scheduled time for execution. If left empty, execution will be queued immediately. - final String? scheduledAt; - - Execution({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.functionId, - required this.deploymentId, - required this.trigger, - required this.status, - required this.requestMethod, - required this.requestPath, - required this.requestHeaders, - required this.responseStatusCode, - required this.responseBody, - required this.responseHeaders, - required this.logs, - required this.errors, - required this.duration, - this.scheduledAt, - }); - - factory Execution.fromMap(Map map) { - return Execution( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - functionId: map['functionId'].toString(), - deploymentId: map['deploymentId'].toString(), - trigger: enums.ExecutionTrigger.values.firstWhere((e) => e.value == map['trigger']), - status: enums.ExecutionStatus.values.firstWhere((e) => e.value == map['status']), - requestMethod: map['requestMethod'].toString(), - requestPath: map['requestPath'].toString(), - requestHeaders: List.from(map['requestHeaders'].map((p) => Headers.fromMap(p))), - responseStatusCode: map['responseStatusCode'], - responseBody: map['responseBody'].toString(), - responseHeaders: List.from(map['responseHeaders'].map((p) => Headers.fromMap(p))), - logs: map['logs'].toString(), - errors: map['errors'].toString(), - duration: map['duration'].toDouble(), - scheduledAt: map['scheduledAt']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "functionId": functionId, - "deploymentId": deploymentId, - "trigger": trigger.value, - "status": status.value, - "requestMethod": requestMethod, - "requestPath": requestPath, - "requestHeaders": requestHeaders.map((p) => p.toMap()).toList(), - "responseStatusCode": responseStatusCode, - "responseBody": responseBody, - "responseHeaders": responseHeaders.map((p) => p.toMap()).toList(), - "logs": logs, - "errors": errors, - "duration": duration, - "scheduledAt": scheduledAt, - }; - } + /// Execution ID. + final String $id; + + /// Execution creation date in ISO 8601 format. + final String $createdAt; + + /// Execution update date in ISO 8601 format. + final String $updatedAt; + + /// Execution roles. + final List $permissions; + + /// Function ID. + final String functionId; + + /// Function's deployment ID used to create the execution. + final String deploymentId; + + /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + final enums.ExecutionTrigger trigger; + + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + final enums.ExecutionStatus status; + + /// HTTP request method type. + final String requestMethod; + + /// HTTP request path and query. + final String requestPath; + + /// HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + final List requestHeaders; + + /// HTTP response status code. + final int responseStatusCode; + + /// HTTP response body. This will return empty unless execution is created as synchronous. + final String responseBody; + + /// HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + final List responseHeaders; + + /// Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + final String logs; + + /// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + final String errors; + + /// Resource(function/site) execution duration in seconds. + final double duration; + + /// The scheduled time for execution. If left empty, execution will be queued immediately. + final String? scheduledAt; + + Execution({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.functionId, + required this.deploymentId, + required this.trigger, + required this.status, + required this.requestMethod, + required this.requestPath, + required this.requestHeaders, + required this.responseStatusCode, + required this.responseBody, + required this.responseHeaders, + required this.logs, + required this.errors, + required this.duration, + this.scheduledAt, + }); + + factory Execution.fromMap(Map map) { + return Execution( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + functionId: map['functionId'].toString(), + deploymentId: map['deploymentId'].toString(), + trigger: enums.ExecutionTrigger.values + .firstWhere((e) => e.value == map['trigger']), + status: enums.ExecutionStatus.values + .firstWhere((e) => e.value == map['status']), + requestMethod: map['requestMethod'].toString(), + requestPath: map['requestPath'].toString(), + requestHeaders: List.from( + map['requestHeaders'].map((p) => Headers.fromMap(p))), + responseStatusCode: map['responseStatusCode'], + responseBody: map['responseBody'].toString(), + responseHeaders: List.from( + map['responseHeaders'].map((p) => Headers.fromMap(p))), + logs: map['logs'].toString(), + errors: map['errors'].toString(), + duration: map['duration'].toDouble(), + scheduledAt: map['scheduledAt']?.toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "functionId": functionId, + "deploymentId": deploymentId, + "trigger": trigger.value, + "status": status.value, + "requestMethod": requestMethod, + "requestPath": requestPath, + "requestHeaders": requestHeaders.map((p) => p.toMap()).toList(), + "responseStatusCode": responseStatusCode, + "responseBody": responseBody, + "responseHeaders": responseHeaders.map((p) => p.toMap()).toList(), + "logs": logs, + "errors": errors, + "duration": duration, + "scheduledAt": scheduledAt, + }; + } } diff --git a/lib/src/models/execution_list.dart b/lib/src/models/execution_list.dart index 45b60682..63c2ad7e 100644 --- a/lib/src/models/execution_list.dart +++ b/lib/src/models/execution_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Executions List class ExecutionList implements Model { - /// Total number of executions that matched your query. - final int total; + /// Total number of executions that matched your query. + final int total; - /// List of executions. - final List executions; + /// List of executions. + final List executions; - ExecutionList({ - required this.total, - required this.executions, - }); + ExecutionList({ + required this.total, + required this.executions, + }); - factory ExecutionList.fromMap(Map map) { - return ExecutionList( - total: map['total'], - executions: List.from(map['executions'].map((p) => Execution.fromMap(p))), - ); - } + factory ExecutionList.fromMap(Map map) { + return ExecutionList( + total: map['total'], + executions: List.from( + map['executions'].map((p) => Execution.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "executions": executions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "executions": executions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/file.dart b/lib/src/models/file.dart index 0315d4a7..d17a8aac 100644 --- a/lib/src/models/file.dart +++ b/lib/src/models/file.dart @@ -2,95 +2,95 @@ part of '../../models.dart'; /// File class File implements Model { - /// File ID. - final String $id; - - /// Bucket ID. - final String bucketId; - - /// File creation date in ISO 8601 format. - final String $createdAt; - - /// File update date in ISO 8601 format. - final String $updatedAt; - - /// File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; - - /// File name. - final String name; - - /// File MD5 signature. - final String signature; - - /// File mime type. - final String mimeType; - - /// File original size in bytes. - final int sizeOriginal; - - /// Total number of chunks available - final int chunksTotal; - - /// Total number of chunks uploaded - final int chunksUploaded; - - /// Whether file contents are encrypted at rest. - final bool encryption; - - /// Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - final String compression; - - File({ - required this.$id, - required this.bucketId, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.name, - required this.signature, - required this.mimeType, - required this.sizeOriginal, - required this.chunksTotal, - required this.chunksUploaded, - required this.encryption, - required this.compression, - }); - - factory File.fromMap(Map map) { - return File( - $id: map['\$id'].toString(), - bucketId: map['bucketId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - name: map['name'].toString(), - signature: map['signature'].toString(), - mimeType: map['mimeType'].toString(), - sizeOriginal: map['sizeOriginal'], - chunksTotal: map['chunksTotal'], - chunksUploaded: map['chunksUploaded'], - encryption: map['encryption'], - compression: map['compression'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "bucketId": bucketId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "name": name, - "signature": signature, - "mimeType": mimeType, - "sizeOriginal": sizeOriginal, - "chunksTotal": chunksTotal, - "chunksUploaded": chunksUploaded, - "encryption": encryption, - "compression": compression, - }; - } + /// File ID. + final String $id; + + /// Bucket ID. + final String bucketId; + + /// File creation date in ISO 8601 format. + final String $createdAt; + + /// File update date in ISO 8601 format. + final String $updatedAt; + + /// File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; + + /// File name. + final String name; + + /// File MD5 signature. + final String signature; + + /// File mime type. + final String mimeType; + + /// File original size in bytes. + final int sizeOriginal; + + /// Total number of chunks available + final int chunksTotal; + + /// Total number of chunks uploaded + final int chunksUploaded; + + /// Whether file contents are encrypted at rest. + final bool encryption; + + /// Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + final String compression; + + File({ + required this.$id, + required this.bucketId, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.name, + required this.signature, + required this.mimeType, + required this.sizeOriginal, + required this.chunksTotal, + required this.chunksUploaded, + required this.encryption, + required this.compression, + }); + + factory File.fromMap(Map map) { + return File( + $id: map['\$id'].toString(), + bucketId: map['bucketId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + name: map['name'].toString(), + signature: map['signature'].toString(), + mimeType: map['mimeType'].toString(), + sizeOriginal: map['sizeOriginal'], + chunksTotal: map['chunksTotal'], + chunksUploaded: map['chunksUploaded'], + encryption: map['encryption'], + compression: map['compression'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "bucketId": bucketId, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "name": name, + "signature": signature, + "mimeType": mimeType, + "sizeOriginal": sizeOriginal, + "chunksTotal": chunksTotal, + "chunksUploaded": chunksUploaded, + "encryption": encryption, + "compression": compression, + }; + } } diff --git a/lib/src/models/file_list.dart b/lib/src/models/file_list.dart index 84c54b2e..1157554a 100644 --- a/lib/src/models/file_list.dart +++ b/lib/src/models/file_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Files List class FileList implements Model { - /// Total number of files that matched your query. - final int total; + /// Total number of files that matched your query. + final int total; - /// List of files. - final List files; + /// List of files. + final List files; - FileList({ - required this.total, - required this.files, - }); + FileList({ + required this.total, + required this.files, + }); - factory FileList.fromMap(Map map) { - return FileList( - total: map['total'], - files: List.from(map['files'].map((p) => File.fromMap(p))), - ); - } + factory FileList.fromMap(Map map) { + return FileList( + total: map['total'], + files: List.from(map['files'].map((p) => File.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "files": files.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "files": files.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/framework.dart b/lib/src/models/framework.dart index 98e9b781..b8004b02 100644 --- a/lib/src/models/framework.dart +++ b/lib/src/models/framework.dart @@ -2,47 +2,48 @@ part of '../../models.dart'; /// Framework class Framework implements Model { - /// Framework key. - final String key; - - /// Framework Name. - final String name; - - /// Default runtime version. - final String buildRuntime; - - /// List of supported runtime versions. - final List runtimes; - - /// List of supported adapters. - final List adapters; - - Framework({ - required this.key, - required this.name, - required this.buildRuntime, - required this.runtimes, - required this.adapters, - }); - - factory Framework.fromMap(Map map) { - return Framework( - key: map['key'].toString(), - name: map['name'].toString(), - buildRuntime: map['buildRuntime'].toString(), - runtimes: List.from(map['runtimes'] ?? []), - adapters: List.from(map['adapters'].map((p) => FrameworkAdapter.fromMap(p))), - ); - } - - @override - Map toMap() { - return { - "key": key, - "name": name, - "buildRuntime": buildRuntime, - "runtimes": runtimes, - "adapters": adapters.map((p) => p.toMap()).toList(), - }; - } + /// Framework key. + final String key; + + /// Framework Name. + final String name; + + /// Default runtime version. + final String buildRuntime; + + /// List of supported runtime versions. + final List runtimes; + + /// List of supported adapters. + final List adapters; + + Framework({ + required this.key, + required this.name, + required this.buildRuntime, + required this.runtimes, + required this.adapters, + }); + + factory Framework.fromMap(Map map) { + return Framework( + key: map['key'].toString(), + name: map['name'].toString(), + buildRuntime: map['buildRuntime'].toString(), + runtimes: List.from(map['runtimes'] ?? []), + adapters: List.from( + map['adapters'].map((p) => FrameworkAdapter.fromMap(p))), + ); + } + + @override + Map toMap() { + return { + "key": key, + "name": name, + "buildRuntime": buildRuntime, + "runtimes": runtimes, + "adapters": adapters.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/framework_adapter.dart b/lib/src/models/framework_adapter.dart index 3531430e..f2bb826d 100644 --- a/lib/src/models/framework_adapter.dart +++ b/lib/src/models/framework_adapter.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// Framework Adapter class FrameworkAdapter implements Model { - /// Adapter key. - final String key; - - /// Default command to download dependencies. - final String installCommand; - - /// Default command to build site into output directory. - final String buildCommand; - - /// Default output directory of build. - final String outputDirectory; - - /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - final String fallbackFile; - - FrameworkAdapter({ - required this.key, - required this.installCommand, - required this.buildCommand, - required this.outputDirectory, - required this.fallbackFile, - }); - - factory FrameworkAdapter.fromMap(Map map) { - return FrameworkAdapter( - key: map['key'].toString(), - installCommand: map['installCommand'].toString(), - buildCommand: map['buildCommand'].toString(), - outputDirectory: map['outputDirectory'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - @override - Map toMap() { - return { - "key": key, - "installCommand": installCommand, - "buildCommand": buildCommand, - "outputDirectory": outputDirectory, - "fallbackFile": fallbackFile, - }; - } + /// Adapter key. + final String key; + + /// Default command to download dependencies. + final String installCommand; + + /// Default command to build site into output directory. + final String buildCommand; + + /// Default output directory of build. + final String outputDirectory; + + /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + final String fallbackFile; + + FrameworkAdapter({ + required this.key, + required this.installCommand, + required this.buildCommand, + required this.outputDirectory, + required this.fallbackFile, + }); + + factory FrameworkAdapter.fromMap(Map map) { + return FrameworkAdapter( + key: map['key'].toString(), + installCommand: map['installCommand'].toString(), + buildCommand: map['buildCommand'].toString(), + outputDirectory: map['outputDirectory'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + @override + Map toMap() { + return { + "key": key, + "installCommand": installCommand, + "buildCommand": buildCommand, + "outputDirectory": outputDirectory, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/framework_list.dart b/lib/src/models/framework_list.dart index 92cdc520..2c7f35b0 100644 --- a/lib/src/models/framework_list.dart +++ b/lib/src/models/framework_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Frameworks List class FrameworkList implements Model { - /// Total number of frameworks that matched your query. - final int total; + /// Total number of frameworks that matched your query. + final int total; - /// List of frameworks. - final List frameworks; + /// List of frameworks. + final List frameworks; - FrameworkList({ - required this.total, - required this.frameworks, - }); + FrameworkList({ + required this.total, + required this.frameworks, + }); - factory FrameworkList.fromMap(Map map) { - return FrameworkList( - total: map['total'], - frameworks: List.from(map['frameworks'].map((p) => Framework.fromMap(p))), - ); - } + factory FrameworkList.fromMap(Map map) { + return FrameworkList( + total: map['total'], + frameworks: List.from( + map['frameworks'].map((p) => Framework.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "frameworks": frameworks.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "frameworks": frameworks.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/function.dart b/lib/src/models/function.dart index e324613c..ddf8accb 100644 --- a/lib/src/models/function.dart +++ b/lib/src/models/function.dart @@ -2,197 +2,197 @@ part of '../../models.dart'; /// Function class Func implements Model { - /// Function ID. - final String $id; + /// Function ID. + final String $id; - /// Function creation date in ISO 8601 format. - final String $createdAt; + /// Function creation date in ISO 8601 format. + final String $createdAt; - /// Function update date in ISO 8601 format. - final String $updatedAt; + /// Function update date in ISO 8601 format. + final String $updatedAt; - /// Execution permissions. - final List execute; + /// Execution permissions. + final List execute; - /// Function name. - final String name; + /// Function name. + final String name; - /// Function enabled. - final bool enabled; + /// Function enabled. + final bool enabled; - /// Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. - final bool live; + /// Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. + final bool live; - /// When disabled, executions will exclude logs and errors, and will be slightly faster. - final bool logging; + /// When disabled, executions will exclude logs and errors, and will be slightly faster. + final bool logging; - /// Function execution and build runtime. - final String runtime; + /// Function execution and build runtime. + final String runtime; - /// How many days to keep the non-active deployments before they will be automatically deleted. - final int deploymentRetention; - - /// Function's active deployment ID. - final String deploymentId; - - /// Active deployment creation date in ISO 8601 format. - final String deploymentCreatedAt; - - /// Function's latest deployment ID. - final String latestDeploymentId; - - /// Latest deployment creation date in ISO 8601 format. - final String latestDeploymentCreatedAt; - - /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - final String latestDeploymentStatus; - - /// Allowed permission scopes. - final List scopes; - - /// Function variables. - final List vars; - - /// Function trigger events. - final List events; - - /// Function execution schedule in CRON format. - final String schedule; - - /// Function execution timeout in seconds. - final int timeout; - - /// The entrypoint file used to execute the deployment. - final String entrypoint; - - /// The build command used to build the deployment. - final String commands; - - /// Version of Open Runtimes used for the function. - final String version; - - /// Function VCS (Version Control System) installation id. - final String installationId; - - /// VCS (Version Control System) Repository ID - final String providerRepositoryId; - - /// VCS (Version Control System) branch name - final String providerBranch; - - /// Path to function in VCS (Version Control System) repository - final String providerRootDirectory; - - /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - final bool providerSilentMode; - - /// Machine specification for deployment builds. - final String buildSpecification; - - /// Machine specification for executions. - final String runtimeSpecification; - - Func({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.execute, - required this.name, - required this.enabled, - required this.live, - required this.logging, - required this.runtime, - required this.deploymentRetention, - required this.deploymentId, - required this.deploymentCreatedAt, - required this.latestDeploymentId, - required this.latestDeploymentCreatedAt, - required this.latestDeploymentStatus, - required this.scopes, - required this.vars, - required this.events, - required this.schedule, - required this.timeout, - required this.entrypoint, - required this.commands, - required this.version, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.buildSpecification, - required this.runtimeSpecification, - }); - - factory Func.fromMap(Map map) { - return Func( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - execute: List.from(map['execute'] ?? []), - name: map['name'].toString(), - enabled: map['enabled'], - live: map['live'], - logging: map['logging'], - runtime: map['runtime'].toString(), - deploymentRetention: map['deploymentRetention'], - deploymentId: map['deploymentId'].toString(), - deploymentCreatedAt: map['deploymentCreatedAt'].toString(), - latestDeploymentId: map['latestDeploymentId'].toString(), - latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), - latestDeploymentStatus: map['latestDeploymentStatus'].toString(), - scopes: List.from(map['scopes'] ?? []), - vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), - events: List.from(map['events'] ?? []), - schedule: map['schedule'].toString(), - timeout: map['timeout'], - entrypoint: map['entrypoint'].toString(), - commands: map['commands'].toString(), - version: map['version'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - buildSpecification: map['buildSpecification'].toString(), - runtimeSpecification: map['runtimeSpecification'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "execute": execute, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "runtime": runtime, - "deploymentRetention": deploymentRetention, - "deploymentId": deploymentId, - "deploymentCreatedAt": deploymentCreatedAt, - "latestDeploymentId": latestDeploymentId, - "latestDeploymentCreatedAt": latestDeploymentCreatedAt, - "latestDeploymentStatus": latestDeploymentStatus, - "scopes": scopes, - "vars": vars.map((p) => p.toMap()).toList(), - "events": events, - "schedule": schedule, - "timeout": timeout, - "entrypoint": entrypoint, - "commands": commands, - "version": version, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "buildSpecification": buildSpecification, - "runtimeSpecification": runtimeSpecification, - }; - } + /// How many days to keep the non-active deployments before they will be automatically deleted. + final int deploymentRetention; + + /// Function's active deployment ID. + final String deploymentId; + + /// Active deployment creation date in ISO 8601 format. + final String deploymentCreatedAt; + + /// Function's latest deployment ID. + final String latestDeploymentId; + + /// Latest deployment creation date in ISO 8601 format. + final String latestDeploymentCreatedAt; + + /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + final String latestDeploymentStatus; + + /// Allowed permission scopes. + final List scopes; + + /// Function variables. + final List vars; + + /// Function trigger events. + final List events; + + /// Function execution schedule in CRON format. + final String schedule; + + /// Function execution timeout in seconds. + final int timeout; + + /// The entrypoint file used to execute the deployment. + final String entrypoint; + + /// The build command used to build the deployment. + final String commands; + + /// Version of Open Runtimes used for the function. + final String version; + + /// Function VCS (Version Control System) installation id. + final String installationId; + + /// VCS (Version Control System) Repository ID + final String providerRepositoryId; + + /// VCS (Version Control System) branch name + final String providerBranch; + + /// Path to function in VCS (Version Control System) repository + final String providerRootDirectory; + + /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + final bool providerSilentMode; + + /// Machine specification for deployment builds. + final String buildSpecification; + + /// Machine specification for executions. + final String runtimeSpecification; + + Func({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.execute, + required this.name, + required this.enabled, + required this.live, + required this.logging, + required this.runtime, + required this.deploymentRetention, + required this.deploymentId, + required this.deploymentCreatedAt, + required this.latestDeploymentId, + required this.latestDeploymentCreatedAt, + required this.latestDeploymentStatus, + required this.scopes, + required this.vars, + required this.events, + required this.schedule, + required this.timeout, + required this.entrypoint, + required this.commands, + required this.version, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.buildSpecification, + required this.runtimeSpecification, + }); + + factory Func.fromMap(Map map) { + return Func( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + execute: List.from(map['execute'] ?? []), + name: map['name'].toString(), + enabled: map['enabled'], + live: map['live'], + logging: map['logging'], + runtime: map['runtime'].toString(), + deploymentRetention: map['deploymentRetention'], + deploymentId: map['deploymentId'].toString(), + deploymentCreatedAt: map['deploymentCreatedAt'].toString(), + latestDeploymentId: map['latestDeploymentId'].toString(), + latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), + latestDeploymentStatus: map['latestDeploymentStatus'].toString(), + scopes: List.from(map['scopes'] ?? []), + vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), + events: List.from(map['events'] ?? []), + schedule: map['schedule'].toString(), + timeout: map['timeout'], + entrypoint: map['entrypoint'].toString(), + commands: map['commands'].toString(), + version: map['version'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + buildSpecification: map['buildSpecification'].toString(), + runtimeSpecification: map['runtimeSpecification'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "execute": execute, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "runtime": runtime, + "deploymentRetention": deploymentRetention, + "deploymentId": deploymentId, + "deploymentCreatedAt": deploymentCreatedAt, + "latestDeploymentId": latestDeploymentId, + "latestDeploymentCreatedAt": latestDeploymentCreatedAt, + "latestDeploymentStatus": latestDeploymentStatus, + "scopes": scopes, + "vars": vars.map((p) => p.toMap()).toList(), + "events": events, + "schedule": schedule, + "timeout": timeout, + "entrypoint": entrypoint, + "commands": commands, + "version": version, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "buildSpecification": buildSpecification, + "runtimeSpecification": runtimeSpecification, + }; + } } diff --git a/lib/src/models/function_list.dart b/lib/src/models/function_list.dart index 995c70ac..4e41664a 100644 --- a/lib/src/models/function_list.dart +++ b/lib/src/models/function_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Functions List class FunctionList implements Model { - /// Total number of functions that matched your query. - final int total; + /// Total number of functions that matched your query. + final int total; - /// List of functions. - final List functions; + /// List of functions. + final List functions; - FunctionList({ - required this.total, - required this.functions, - }); + FunctionList({ + required this.total, + required this.functions, + }); - factory FunctionList.fromMap(Map map) { - return FunctionList( - total: map['total'], - functions: List.from(map['functions'].map((p) => Func.fromMap(p))), - ); - } + factory FunctionList.fromMap(Map map) { + return FunctionList( + total: map['total'], + functions: List.from(map['functions'].map((p) => Func.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "functions": functions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "functions": functions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/headers.dart b/lib/src/models/headers.dart index bbccf88a..fa054420 100644 --- a/lib/src/models/headers.dart +++ b/lib/src/models/headers.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Headers class Headers implements Model { - /// Header name. - final String name; + /// Header name. + final String name; - /// Header value. - final String value; + /// Header value. + final String value; - Headers({ - required this.name, - required this.value, - }); + Headers({ + required this.name, + required this.value, + }); - factory Headers.fromMap(Map map) { - return Headers( - name: map['name'].toString(), - value: map['value'].toString(), - ); - } + factory Headers.fromMap(Map map) { + return Headers( + name: map['name'].toString(), + value: map['value'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "value": value, - }; - } + @override + Map toMap() { + return { + "name": name, + "value": value, + }; + } } diff --git a/lib/src/models/health_antivirus.dart b/lib/src/models/health_antivirus.dart index 1e041099..4260f8e5 100644 --- a/lib/src/models/health_antivirus.dart +++ b/lib/src/models/health_antivirus.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Health Antivirus class HealthAntivirus implements Model { - /// Antivirus version. - final String version; + /// Antivirus version. + final String version; - /// Antivirus status. Possible values are: `disabled`, `offline`, `online` - final enums.HealthAntivirusStatus status; + /// Antivirus status. Possible values are: `disabled`, `offline`, `online` + final enums.HealthAntivirusStatus status; - HealthAntivirus({ - required this.version, - required this.status, - }); + HealthAntivirus({ + required this.version, + required this.status, + }); - factory HealthAntivirus.fromMap(Map map) { - return HealthAntivirus( - version: map['version'].toString(), - status: enums.HealthAntivirusStatus.values.firstWhere((e) => e.value == map['status']), - ); - } + factory HealthAntivirus.fromMap(Map map) { + return HealthAntivirus( + version: map['version'].toString(), + status: enums.HealthAntivirusStatus.values + .firstWhere((e) => e.value == map['status']), + ); + } - @override - Map toMap() { - return { - "version": version, - "status": status.value, - }; - } + @override + Map toMap() { + return { + "version": version, + "status": status.value, + }; + } } diff --git a/lib/src/models/health_certificate.dart b/lib/src/models/health_certificate.dart index eb1ea068..c20e9146 100644 --- a/lib/src/models/health_certificate.dart +++ b/lib/src/models/health_certificate.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Health Certificate class HealthCertificate implements Model { - /// Certificate name - final String name; - - /// Subject SN - final String subjectSN; - - /// Issuer organisation - final String issuerOrganisation; - - /// Valid from - final String validFrom; - - /// Valid to - final String validTo; - - /// Signature type SN - final String signatureTypeSN; - - HealthCertificate({ - required this.name, - required this.subjectSN, - required this.issuerOrganisation, - required this.validFrom, - required this.validTo, - required this.signatureTypeSN, - }); - - factory HealthCertificate.fromMap(Map map) { - return HealthCertificate( - name: map['name'].toString(), - subjectSN: map['subjectSN'].toString(), - issuerOrganisation: map['issuerOrganisation'].toString(), - validFrom: map['validFrom'].toString(), - validTo: map['validTo'].toString(), - signatureTypeSN: map['signatureTypeSN'].toString(), - ); - } - - @override - Map toMap() { - return { - "name": name, - "subjectSN": subjectSN, - "issuerOrganisation": issuerOrganisation, - "validFrom": validFrom, - "validTo": validTo, - "signatureTypeSN": signatureTypeSN, - }; - } + /// Certificate name + final String name; + + /// Subject SN + final String subjectSN; + + /// Issuer organisation + final String issuerOrganisation; + + /// Valid from + final String validFrom; + + /// Valid to + final String validTo; + + /// Signature type SN + final String signatureTypeSN; + + HealthCertificate({ + required this.name, + required this.subjectSN, + required this.issuerOrganisation, + required this.validFrom, + required this.validTo, + required this.signatureTypeSN, + }); + + factory HealthCertificate.fromMap(Map map) { + return HealthCertificate( + name: map['name'].toString(), + subjectSN: map['subjectSN'].toString(), + issuerOrganisation: map['issuerOrganisation'].toString(), + validFrom: map['validFrom'].toString(), + validTo: map['validTo'].toString(), + signatureTypeSN: map['signatureTypeSN'].toString(), + ); + } + + @override + Map toMap() { + return { + "name": name, + "subjectSN": subjectSN, + "issuerOrganisation": issuerOrganisation, + "validFrom": validFrom, + "validTo": validTo, + "signatureTypeSN": signatureTypeSN, + }; + } } diff --git a/lib/src/models/health_queue.dart b/lib/src/models/health_queue.dart index 3c52f78f..8f39b667 100644 --- a/lib/src/models/health_queue.dart +++ b/lib/src/models/health_queue.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// Health Queue class HealthQueue implements Model { - /// Amount of actions in the queue. - final int size; + /// Amount of actions in the queue. + final int size; - HealthQueue({ - required this.size, - }); + HealthQueue({ + required this.size, + }); - factory HealthQueue.fromMap(Map map) { - return HealthQueue( - size: map['size'], - ); - } + factory HealthQueue.fromMap(Map map) { + return HealthQueue( + size: map['size'], + ); + } - @override - Map toMap() { - return { - "size": size, - }; - } + @override + Map toMap() { + return { + "size": size, + }; + } } diff --git a/lib/src/models/health_status.dart b/lib/src/models/health_status.dart index 8c16480c..f1f073ea 100644 --- a/lib/src/models/health_status.dart +++ b/lib/src/models/health_status.dart @@ -2,35 +2,36 @@ part of '../../models.dart'; /// Health Status class HealthStatus implements Model { - /// Name of the service. - final String name; + /// Name of the service. + final String name; - /// Duration in milliseconds how long the health check took. - final int ping; + /// Duration in milliseconds how long the health check took. + final int ping; - /// Service status. Possible values are: `pass`, `fail` - final enums.HealthCheckStatus status; + /// Service status. Possible values are: `pass`, `fail` + final enums.HealthCheckStatus status; - HealthStatus({ - required this.name, - required this.ping, - required this.status, - }); + HealthStatus({ + required this.name, + required this.ping, + required this.status, + }); - factory HealthStatus.fromMap(Map map) { - return HealthStatus( - name: map['name'].toString(), - ping: map['ping'], - status: enums.HealthCheckStatus.values.firstWhere((e) => e.value == map['status']), - ); - } + factory HealthStatus.fromMap(Map map) { + return HealthStatus( + name: map['name'].toString(), + ping: map['ping'], + status: enums.HealthCheckStatus.values + .firstWhere((e) => e.value == map['status']), + ); + } - @override - Map toMap() { - return { - "name": name, - "ping": ping, - "status": status.value, - }; - } + @override + Map toMap() { + return { + "name": name, + "ping": ping, + "status": status.value, + }; + } } diff --git a/lib/src/models/health_status_list.dart b/lib/src/models/health_status_list.dart index 0d09e6f7..54d8f149 100644 --- a/lib/src/models/health_status_list.dart +++ b/lib/src/models/health_status_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Status List class HealthStatusList implements Model { - /// Total number of statuses that matched your query. - final int total; + /// Total number of statuses that matched your query. + final int total; - /// List of statuses. - final List statuses; + /// List of statuses. + final List statuses; - HealthStatusList({ - required this.total, - required this.statuses, - }); + HealthStatusList({ + required this.total, + required this.statuses, + }); - factory HealthStatusList.fromMap(Map map) { - return HealthStatusList( - total: map['total'], - statuses: List.from(map['statuses'].map((p) => HealthStatus.fromMap(p))), - ); - } + factory HealthStatusList.fromMap(Map map) { + return HealthStatusList( + total: map['total'], + statuses: List.from( + map['statuses'].map((p) => HealthStatus.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "statuses": statuses.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "statuses": statuses.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/health_time.dart b/lib/src/models/health_time.dart index 80d3cad1..6ee89297 100644 --- a/lib/src/models/health_time.dart +++ b/lib/src/models/health_time.dart @@ -2,35 +2,35 @@ part of '../../models.dart'; /// Health Time class HealthTime implements Model { - /// Current unix timestamp on trustful remote server. - final int remoteTime; + /// Current unix timestamp on trustful remote server. + final int remoteTime; - /// Current unix timestamp of local server where Appwrite runs. - final int localTime; + /// Current unix timestamp of local server where Appwrite runs. + final int localTime; - /// Difference of unix remote and local timestamps in milliseconds. - final int diff; + /// Difference of unix remote and local timestamps in milliseconds. + final int diff; - HealthTime({ - required this.remoteTime, - required this.localTime, - required this.diff, - }); + HealthTime({ + required this.remoteTime, + required this.localTime, + required this.diff, + }); - factory HealthTime.fromMap(Map map) { - return HealthTime( - remoteTime: map['remoteTime'], - localTime: map['localTime'], - diff: map['diff'], - ); - } + factory HealthTime.fromMap(Map map) { + return HealthTime( + remoteTime: map['remoteTime'], + localTime: map['localTime'], + diff: map['diff'], + ); + } - @override - Map toMap() { - return { - "remoteTime": remoteTime, - "localTime": localTime, - "diff": diff, - }; - } + @override + Map toMap() { + return { + "remoteTime": remoteTime, + "localTime": localTime, + "diff": diff, + }; + } } diff --git a/lib/src/models/identity.dart b/lib/src/models/identity.dart index 7e90020c..cc659043 100644 --- a/lib/src/models/identity.dart +++ b/lib/src/models/identity.dart @@ -2,77 +2,77 @@ part of '../../models.dart'; /// Identity class Identity implements Model { - /// Identity ID. - final String $id; + /// Identity ID. + final String $id; - /// Identity creation date in ISO 8601 format. - final String $createdAt; + /// Identity creation date in ISO 8601 format. + final String $createdAt; - /// Identity update date in ISO 8601 format. - final String $updatedAt; + /// Identity update date in ISO 8601 format. + final String $updatedAt; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Identity Provider. - final String provider; + /// Identity Provider. + final String provider; - /// ID of the User in the Identity Provider. - final String providerUid; + /// ID of the User in the Identity Provider. + final String providerUid; - /// Email of the User in the Identity Provider. - final String providerEmail; + /// Email of the User in the Identity Provider. + final String providerEmail; - /// Identity Provider Access Token. - final String providerAccessToken; + /// Identity Provider Access Token. + final String providerAccessToken; - /// The date of when the access token expires in ISO 8601 format. - final String providerAccessTokenExpiry; + /// The date of when the access token expires in ISO 8601 format. + final String providerAccessTokenExpiry; - /// Identity Provider Refresh Token. - final String providerRefreshToken; + /// Identity Provider Refresh Token. + final String providerRefreshToken; - Identity({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.userId, - required this.provider, - required this.providerUid, - required this.providerEmail, - required this.providerAccessToken, - required this.providerAccessTokenExpiry, - required this.providerRefreshToken, - }); + Identity({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.userId, + required this.provider, + required this.providerUid, + required this.providerEmail, + required this.providerAccessToken, + required this.providerAccessTokenExpiry, + required this.providerRefreshToken, + }); - factory Identity.fromMap(Map map) { - return Identity( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - userId: map['userId'].toString(), - provider: map['provider'].toString(), - providerUid: map['providerUid'].toString(), - providerEmail: map['providerEmail'].toString(), - providerAccessToken: map['providerAccessToken'].toString(), - providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), - providerRefreshToken: map['providerRefreshToken'].toString(), - ); - } + factory Identity.fromMap(Map map) { + return Identity( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + userId: map['userId'].toString(), + provider: map['provider'].toString(), + providerUid: map['providerUid'].toString(), + providerEmail: map['providerEmail'].toString(), + providerAccessToken: map['providerAccessToken'].toString(), + providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), + providerRefreshToken: map['providerRefreshToken'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "provider": provider, - "providerUid": providerUid, - "providerEmail": providerEmail, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "userId": userId, + "provider": provider, + "providerUid": providerUid, + "providerEmail": providerEmail, + "providerAccessToken": providerAccessToken, + "providerAccessTokenExpiry": providerAccessTokenExpiry, + "providerRefreshToken": providerRefreshToken, + }; + } } diff --git a/lib/src/models/identity_list.dart b/lib/src/models/identity_list.dart index d9cc09a2..a5d39ea0 100644 --- a/lib/src/models/identity_list.dart +++ b/lib/src/models/identity_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Identities List class IdentityList implements Model { - /// Total number of identities that matched your query. - final int total; + /// Total number of identities that matched your query. + final int total; - /// List of identities. - final List identities; + /// List of identities. + final List identities; - IdentityList({ - required this.total, - required this.identities, - }); + IdentityList({ + required this.total, + required this.identities, + }); - factory IdentityList.fromMap(Map map) { - return IdentityList( - total: map['total'], - identities: List.from(map['identities'].map((p) => Identity.fromMap(p))), - ); - } + factory IdentityList.fromMap(Map map) { + return IdentityList( + total: map['total'], + identities: List.from( + map['identities'].map((p) => Identity.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "identities": identities.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "identities": identities.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/index.dart b/lib/src/models/index.dart index dc632069..b3e40a07 100644 --- a/lib/src/models/index.dart +++ b/lib/src/models/index.dart @@ -2,77 +2,78 @@ part of '../../models.dart'; /// Index class Index implements Model { - /// Index ID. - final String $id; + /// Index ID. + final String $id; - /// Index creation date in ISO 8601 format. - final String $createdAt; + /// Index creation date in ISO 8601 format. + final String $createdAt; - /// Index update date in ISO 8601 format. - final String $updatedAt; + /// Index update date in ISO 8601 format. + final String $updatedAt; - /// Index key. - final String key; + /// Index key. + final String key; - /// Index type. - final String type; + /// Index type. + final String type; - /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - final enums.IndexStatus status; + /// Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + final enums.IndexStatus status; - /// Error message. Displays error generated on failure of creating or deleting an index. - final String error; + /// Error message. Displays error generated on failure of creating or deleting an index. + final String error; - /// Index attributes. - final List attributes; + /// Index attributes. + final List attributes; - /// Index attributes length. - final List lengths; + /// Index attributes length. + final List lengths; - /// Index orders. - final List? orders; + /// Index orders. + final List? orders; - Index({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.key, - required this.type, - required this.status, - required this.error, - required this.attributes, - required this.lengths, - this.orders, - }); + Index({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.key, + required this.type, + required this.status, + required this.error, + required this.attributes, + required this.lengths, + this.orders, + }); - factory Index.fromMap(Map map) { - return Index( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - key: map['key'].toString(), - type: map['type'].toString(), - status: enums.IndexStatus.values.firstWhere((e) => e.value == map['status']), - error: map['error'].toString(), - attributes: List.from(map['attributes'] ?? []), - lengths: List.from(map['lengths'] ?? []), - orders: List.from(map['orders'] ?? []), - ); - } + factory Index.fromMap(Map map) { + return Index( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + key: map['key'].toString(), + type: map['type'].toString(), + status: + enums.IndexStatus.values.firstWhere((e) => e.value == map['status']), + error: map['error'].toString(), + attributes: List.from(map['attributes'] ?? []), + lengths: List.from(map['lengths'] ?? []), + orders: List.from(map['orders'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "type": type, - "status": status.value, - "error": error, - "attributes": attributes, - "lengths": lengths, - "orders": orders, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "type": type, + "status": status.value, + "error": error, + "attributes": attributes, + "lengths": lengths, + "orders": orders, + }; + } } diff --git a/lib/src/models/index_list.dart b/lib/src/models/index_list.dart index 8b91c431..b92c5f4b 100644 --- a/lib/src/models/index_list.dart +++ b/lib/src/models/index_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Indexes List class IndexList implements Model { - /// Total number of indexes that matched your query. - final int total; + /// Total number of indexes that matched your query. + final int total; - /// List of indexes. - final List indexes; + /// List of indexes. + final List indexes; - IndexList({ - required this.total, - required this.indexes, - }); + IndexList({ + required this.total, + required this.indexes, + }); - factory IndexList.fromMap(Map map) { - return IndexList( - total: map['total'], - indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), - ); - } + factory IndexList.fromMap(Map map) { + return IndexList( + total: map['total'], + indexes: List.from(map['indexes'].map((p) => Index.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "indexes": indexes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "indexes": indexes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/jwt.dart b/lib/src/models/jwt.dart index 2000acb6..cda66c70 100644 --- a/lib/src/models/jwt.dart +++ b/lib/src/models/jwt.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// JWT class Jwt implements Model { - /// JWT encoded string. - final String jwt; + /// JWT encoded string. + final String jwt; - Jwt({ - required this.jwt, - }); + Jwt({ + required this.jwt, + }); - factory Jwt.fromMap(Map map) { - return Jwt( - jwt: map['jwt'].toString(), - ); - } + factory Jwt.fromMap(Map map) { + return Jwt( + jwt: map['jwt'].toString(), + ); + } - @override - Map toMap() { - return { - "jwt": jwt, - }; - } + @override + Map toMap() { + return { + "jwt": jwt, + }; + } } diff --git a/lib/src/models/key.dart b/lib/src/models/key.dart index f0c50e58..15946090 100644 --- a/lib/src/models/key.dart +++ b/lib/src/models/key.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Key class Key implements Model { - /// Key ID. - final String $id; + /// Key ID. + final String $id; - /// Key creation date in ISO 8601 format. - final String $createdAt; + /// Key creation date in ISO 8601 format. + final String $createdAt; - /// Key update date in ISO 8601 format. - final String $updatedAt; + /// Key update date in ISO 8601 format. + final String $updatedAt; - /// Key name. - final String name; + /// Key name. + final String name; - /// Key expiration date in ISO 8601 format. - final String expire; + /// Key expiration date in ISO 8601 format. + final String expire; - /// Allowed permission scopes. - final List scopes; + /// Allowed permission scopes. + final List scopes; - /// Secret key. - final String secret; + /// Secret key. + final String secret; - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; - /// List of SDK user agents that used this key. - final List sdks; + /// List of SDK user agents that used this key. + final List sdks; - Key({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.expire, - required this.scopes, - required this.secret, - required this.accessedAt, - required this.sdks, - }); + Key({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.expire, + required this.scopes, + required this.secret, + required this.accessedAt, + required this.sdks, + }); - factory Key.fromMap(Map map) { - return Key( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - expire: map['expire'].toString(), - scopes: List.from(map['scopes'] ?? []), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - sdks: List.from(map['sdks'] ?? []), - ); - } + factory Key.fromMap(Map map) { + return Key( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + expire: map['expire'].toString(), + scopes: List.from(map['scopes'] ?? []), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + sdks: List.from(map['sdks'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "expire": expire, - "scopes": scopes, - "secret": secret, - "accessedAt": accessedAt, - "sdks": sdks, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "expire": expire, + "scopes": scopes, + "secret": secret, + "accessedAt": accessedAt, + "sdks": sdks, + }; + } } diff --git a/lib/src/models/key_list.dart b/lib/src/models/key_list.dart index e5e99a7f..127a6cd7 100644 --- a/lib/src/models/key_list.dart +++ b/lib/src/models/key_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// API Keys List class KeyList implements Model { - /// Total number of keys that matched your query. - final int total; + /// Total number of keys that matched your query. + final int total; - /// List of keys. - final List keys; + /// List of keys. + final List keys; - KeyList({ - required this.total, - required this.keys, - }); + KeyList({ + required this.total, + required this.keys, + }); - factory KeyList.fromMap(Map map) { - return KeyList( - total: map['total'], - keys: List.from(map['keys'].map((p) => Key.fromMap(p))), - ); - } + factory KeyList.fromMap(Map map) { + return KeyList( + total: map['total'], + keys: List.from(map['keys'].map((p) => Key.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "keys": keys.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "keys": keys.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/language.dart b/lib/src/models/language.dart index 1422d065..87dc3606 100644 --- a/lib/src/models/language.dart +++ b/lib/src/models/language.dart @@ -2,35 +2,35 @@ part of '../../models.dart'; /// Language class Language implements Model { - /// Language name. - final String name; + /// Language name. + final String name; - /// Language two-character ISO 639-1 codes. - final String code; + /// Language two-character ISO 639-1 codes. + final String code; - /// Language native name. - final String nativeName; + /// Language native name. + final String nativeName; - Language({ - required this.name, - required this.code, - required this.nativeName, - }); + Language({ + required this.name, + required this.code, + required this.nativeName, + }); - factory Language.fromMap(Map map) { - return Language( - name: map['name'].toString(), - code: map['code'].toString(), - nativeName: map['nativeName'].toString(), - ); - } + factory Language.fromMap(Map map) { + return Language( + name: map['name'].toString(), + code: map['code'].toString(), + nativeName: map['nativeName'].toString(), + ); + } - @override - Map toMap() { - return { - "name": name, - "code": code, - "nativeName": nativeName, - }; - } + @override + Map toMap() { + return { + "name": name, + "code": code, + "nativeName": nativeName, + }; + } } diff --git a/lib/src/models/language_list.dart b/lib/src/models/language_list.dart index 5d78a367..6198d61e 100644 --- a/lib/src/models/language_list.dart +++ b/lib/src/models/language_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Languages List class LanguageList implements Model { - /// Total number of languages that matched your query. - final int total; + /// Total number of languages that matched your query. + final int total; - /// List of languages. - final List languages; + /// List of languages. + final List languages; - LanguageList({ - required this.total, - required this.languages, - }); + LanguageList({ + required this.total, + required this.languages, + }); - factory LanguageList.fromMap(Map map) { - return LanguageList( - total: map['total'], - languages: List.from(map['languages'].map((p) => Language.fromMap(p))), - ); - } + factory LanguageList.fromMap(Map map) { + return LanguageList( + total: map['total'], + languages: + List.from(map['languages'].map((p) => Language.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "languages": languages.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "languages": languages.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/locale.dart b/lib/src/models/locale.dart index 3292a896..54dd0c29 100644 --- a/lib/src/models/locale.dart +++ b/lib/src/models/locale.dart @@ -2,59 +2,59 @@ part of '../../models.dart'; /// Locale class Locale implements Model { - /// User IP address. - final String ip; - - /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format - final String countryCode; - - /// Country name. This field support localization. - final String country; - - /// Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. - final String continentCode; - - /// Continent name. This field support localization. - final String continent; - - /// True if country is part of the European Union. - final bool eu; - - /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format - final String currency; - - Locale({ - required this.ip, - required this.countryCode, - required this.country, - required this.continentCode, - required this.continent, - required this.eu, - required this.currency, - }); - - factory Locale.fromMap(Map map) { - return Locale( - ip: map['ip'].toString(), - countryCode: map['countryCode'].toString(), - country: map['country'].toString(), - continentCode: map['continentCode'].toString(), - continent: map['continent'].toString(), - eu: map['eu'], - currency: map['currency'].toString(), - ); - } - - @override - Map toMap() { - return { - "ip": ip, - "countryCode": countryCode, - "country": country, - "continentCode": continentCode, - "continent": continent, - "eu": eu, - "currency": currency, - }; - } + /// User IP address. + final String ip; + + /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format + final String countryCode; + + /// Country name. This field support localization. + final String country; + + /// Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. + final String continentCode; + + /// Continent name. This field support localization. + final String continent; + + /// True if country is part of the European Union. + final bool eu; + + /// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format + final String currency; + + Locale({ + required this.ip, + required this.countryCode, + required this.country, + required this.continentCode, + required this.continent, + required this.eu, + required this.currency, + }); + + factory Locale.fromMap(Map map) { + return Locale( + ip: map['ip'].toString(), + countryCode: map['countryCode'].toString(), + country: map['country'].toString(), + continentCode: map['continentCode'].toString(), + continent: map['continent'].toString(), + eu: map['eu'], + currency: map['currency'].toString(), + ); + } + + @override + Map toMap() { + return { + "ip": ip, + "countryCode": countryCode, + "country": country, + "continentCode": continentCode, + "continent": continent, + "eu": eu, + "currency": currency, + }; + } } diff --git a/lib/src/models/locale_code.dart b/lib/src/models/locale_code.dart index 49ef3b0b..21405aff 100644 --- a/lib/src/models/locale_code.dart +++ b/lib/src/models/locale_code.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// LocaleCode class LocaleCode implements Model { - /// Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - final String code; + /// Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + final String code; - /// Locale name - final String name; + /// Locale name + final String name; - LocaleCode({ - required this.code, - required this.name, - }); + LocaleCode({ + required this.code, + required this.name, + }); - factory LocaleCode.fromMap(Map map) { - return LocaleCode( - code: map['code'].toString(), - name: map['name'].toString(), - ); - } + factory LocaleCode.fromMap(Map map) { + return LocaleCode( + code: map['code'].toString(), + name: map['name'].toString(), + ); + } - @override - Map toMap() { - return { - "code": code, - "name": name, - }; - } + @override + Map toMap() { + return { + "code": code, + "name": name, + }; + } } diff --git a/lib/src/models/locale_code_list.dart b/lib/src/models/locale_code_list.dart index a3a26b61..202355a4 100644 --- a/lib/src/models/locale_code_list.dart +++ b/lib/src/models/locale_code_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Locale codes list class LocaleCodeList implements Model { - /// Total number of localeCodes that matched your query. - final int total; + /// Total number of localeCodes that matched your query. + final int total; - /// List of localeCodes. - final List localeCodes; + /// List of localeCodes. + final List localeCodes; - LocaleCodeList({ - required this.total, - required this.localeCodes, - }); + LocaleCodeList({ + required this.total, + required this.localeCodes, + }); - factory LocaleCodeList.fromMap(Map map) { - return LocaleCodeList( - total: map['total'], - localeCodes: List.from(map['localeCodes'].map((p) => LocaleCode.fromMap(p))), - ); - } + factory LocaleCodeList.fromMap(Map map) { + return LocaleCodeList( + total: map['total'], + localeCodes: List.from( + map['localeCodes'].map((p) => LocaleCode.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "localeCodes": localeCodes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "localeCodes": localeCodes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/log.dart b/lib/src/models/log.dart index 406fcbcf..572cce50 100644 --- a/lib/src/models/log.dart +++ b/lib/src/models/log.dart @@ -2,149 +2,149 @@ part of '../../models.dart'; /// Log class Log implements Model { - /// Event name. - final String event; - - /// User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. - final String userId; - - /// User email of the actor recorded for this log. During impersonation, this is the original impersonator. - final String userEmail; - - /// User name of the actor recorded for this log. During impersonation, this is the original impersonator. - final String userName; - - /// API mode when event triggered. - final String mode; - - /// User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. - final String userType; - - /// IP session in use when the session was created. - final String ip; - - /// Log creation date in ISO 8601 format. - final String time; - - /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - final String osCode; - - /// Operating system name. - final String osName; - - /// Operating system version. - final String osVersion; - - /// Client type. - final String clientType; - - /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - final String clientCode; - - /// Client name. - final String clientName; - - /// Client version. - final String clientVersion; - - /// Client engine name. - final String clientEngine; - - /// Client engine name. - final String clientEngineVersion; - - /// Device name. - final String deviceName; - - /// Device brand name. - final String deviceBrand; - - /// Device model name. - final String deviceModel; - - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; - - /// Country name. - final String countryName; - - Log({ - required this.event, - required this.userId, - required this.userEmail, - required this.userName, - required this.mode, - required this.userType, - required this.ip, - required this.time, - required this.osCode, - required this.osName, - required this.osVersion, - required this.clientType, - required this.clientCode, - required this.clientName, - required this.clientVersion, - required this.clientEngine, - required this.clientEngineVersion, - required this.deviceName, - required this.deviceBrand, - required this.deviceModel, - required this.countryCode, - required this.countryName, - }); - - factory Log.fromMap(Map map) { - return Log( - event: map['event'].toString(), - userId: map['userId'].toString(), - userEmail: map['userEmail'].toString(), - userName: map['userName'].toString(), - mode: map['mode'].toString(), - userType: map['userType'].toString(), - ip: map['ip'].toString(), - time: map['time'].toString(), - osCode: map['osCode'].toString(), - osName: map['osName'].toString(), - osVersion: map['osVersion'].toString(), - clientType: map['clientType'].toString(), - clientCode: map['clientCode'].toString(), - clientName: map['clientName'].toString(), - clientVersion: map['clientVersion'].toString(), - clientEngine: map['clientEngine'].toString(), - clientEngineVersion: map['clientEngineVersion'].toString(), - deviceName: map['deviceName'].toString(), - deviceBrand: map['deviceBrand'].toString(), - deviceModel: map['deviceModel'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - ); - } - - @override - Map toMap() { - return { - "event": event, - "userId": userId, - "userEmail": userEmail, - "userName": userName, - "mode": mode, - "userType": userType, - "ip": ip, - "time": time, - "osCode": osCode, - "osName": osName, - "osVersion": osVersion, - "clientType": clientType, - "clientCode": clientCode, - "clientName": clientName, - "clientVersion": clientVersion, - "clientEngine": clientEngine, - "clientEngineVersion": clientEngineVersion, - "deviceName": deviceName, - "deviceBrand": deviceBrand, - "deviceModel": deviceModel, - "countryCode": countryCode, - "countryName": countryName, - }; - } + /// Event name. + final String event; + + /// User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. + final String userId; + + /// User email of the actor recorded for this log. During impersonation, this is the original impersonator. + final String userEmail; + + /// User name of the actor recorded for this log. During impersonation, this is the original impersonator. + final String userName; + + /// API mode when event triggered. + final String mode; + + /// User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + final String userType; + + /// IP session in use when the session was created. + final String ip; + + /// Log creation date in ISO 8601 format. + final String time; + + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + final String osCode; + + /// Operating system name. + final String osName; + + /// Operating system version. + final String osVersion; + + /// Client type. + final String clientType; + + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + final String clientCode; + + /// Client name. + final String clientName; + + /// Client version. + final String clientVersion; + + /// Client engine name. + final String clientEngine; + + /// Client engine name. + final String clientEngineVersion; + + /// Device name. + final String deviceName; + + /// Device brand name. + final String deviceBrand; + + /// Device model name. + final String deviceModel; + + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; + + /// Country name. + final String countryName; + + Log({ + required this.event, + required this.userId, + required this.userEmail, + required this.userName, + required this.mode, + required this.userType, + required this.ip, + required this.time, + required this.osCode, + required this.osName, + required this.osVersion, + required this.clientType, + required this.clientCode, + required this.clientName, + required this.clientVersion, + required this.clientEngine, + required this.clientEngineVersion, + required this.deviceName, + required this.deviceBrand, + required this.deviceModel, + required this.countryCode, + required this.countryName, + }); + + factory Log.fromMap(Map map) { + return Log( + event: map['event'].toString(), + userId: map['userId'].toString(), + userEmail: map['userEmail'].toString(), + userName: map['userName'].toString(), + mode: map['mode'].toString(), + userType: map['userType'].toString(), + ip: map['ip'].toString(), + time: map['time'].toString(), + osCode: map['osCode'].toString(), + osName: map['osName'].toString(), + osVersion: map['osVersion'].toString(), + clientType: map['clientType'].toString(), + clientCode: map['clientCode'].toString(), + clientName: map['clientName'].toString(), + clientVersion: map['clientVersion'].toString(), + clientEngine: map['clientEngine'].toString(), + clientEngineVersion: map['clientEngineVersion'].toString(), + deviceName: map['deviceName'].toString(), + deviceBrand: map['deviceBrand'].toString(), + deviceModel: map['deviceModel'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + ); + } + + @override + Map toMap() { + return { + "event": event, + "userId": userId, + "userEmail": userEmail, + "userName": userName, + "mode": mode, + "userType": userType, + "ip": ip, + "time": time, + "osCode": osCode, + "osName": osName, + "osVersion": osVersion, + "clientType": clientType, + "clientCode": clientCode, + "clientName": clientName, + "clientVersion": clientVersion, + "clientEngine": clientEngine, + "clientEngineVersion": clientEngineVersion, + "deviceName": deviceName, + "deviceBrand": deviceBrand, + "deviceModel": deviceModel, + "countryCode": countryCode, + "countryName": countryName, + }; + } } diff --git a/lib/src/models/log_list.dart b/lib/src/models/log_list.dart index ebf593c2..3494b111 100644 --- a/lib/src/models/log_list.dart +++ b/lib/src/models/log_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Logs List class LogList implements Model { - /// Total number of logs that matched your query. - final int total; + /// Total number of logs that matched your query. + final int total; - /// List of logs. - final List logs; + /// List of logs. + final List logs; - LogList({ - required this.total, - required this.logs, - }); + LogList({ + required this.total, + required this.logs, + }); - factory LogList.fromMap(Map map) { - return LogList( - total: map['total'], - logs: List.from(map['logs'].map((p) => Log.fromMap(p))), - ); - } + factory LogList.fromMap(Map map) { + return LogList( + total: map['total'], + logs: List.from(map['logs'].map((p) => Log.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "logs": logs.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "logs": logs.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/membership.dart b/lib/src/models/membership.dart index 68a661b2..20091400 100644 --- a/lib/src/models/membership.dart +++ b/lib/src/models/membership.dart @@ -2,101 +2,101 @@ part of '../../models.dart'; /// Membership class Membership implements Model { - /// Membership ID. - final String $id; - - /// Membership creation date in ISO 8601 format. - final String $createdAt; - - /// Membership update date in ISO 8601 format. - final String $updatedAt; - - /// User ID. - final String userId; - - /// User name. Hide this attribute by toggling membership privacy in the Console. - final String userName; - - /// User email address. Hide this attribute by toggling membership privacy in the Console. - final String userEmail; - - /// User phone number. Hide this attribute by toggling membership privacy in the Console. - final String userPhone; - - /// Team ID. - final String teamId; - - /// Team name. - final String teamName; - - /// Date, the user has been invited to join the team in ISO 8601 format. - final String invited; - - /// Date, the user has accepted the invitation to join the team in ISO 8601 format. - final String joined; - - /// User confirmation status, true if the user has joined the team or false otherwise. - final bool confirm; - - /// Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. - final bool mfa; - - /// User list of roles - final List roles; - - Membership({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.userId, - required this.userName, - required this.userEmail, - required this.userPhone, - required this.teamId, - required this.teamName, - required this.invited, - required this.joined, - required this.confirm, - required this.mfa, - required this.roles, - }); - - factory Membership.fromMap(Map map) { - return Membership( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - userId: map['userId'].toString(), - userName: map['userName'].toString(), - userEmail: map['userEmail'].toString(), - userPhone: map['userPhone'].toString(), - teamId: map['teamId'].toString(), - teamName: map['teamName'].toString(), - invited: map['invited'].toString(), - joined: map['joined'].toString(), - confirm: map['confirm'], - mfa: map['mfa'], - roles: List.from(map['roles'] ?? []), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "userName": userName, - "userEmail": userEmail, - "userPhone": userPhone, - "teamId": teamId, - "teamName": teamName, - "invited": invited, - "joined": joined, - "confirm": confirm, - "mfa": mfa, - "roles": roles, - }; - } + /// Membership ID. + final String $id; + + /// Membership creation date in ISO 8601 format. + final String $createdAt; + + /// Membership update date in ISO 8601 format. + final String $updatedAt; + + /// User ID. + final String userId; + + /// User name. Hide this attribute by toggling membership privacy in the Console. + final String userName; + + /// User email address. Hide this attribute by toggling membership privacy in the Console. + final String userEmail; + + /// User phone number. Hide this attribute by toggling membership privacy in the Console. + final String userPhone; + + /// Team ID. + final String teamId; + + /// Team name. + final String teamName; + + /// Date, the user has been invited to join the team in ISO 8601 format. + final String invited; + + /// Date, the user has accepted the invitation to join the team in ISO 8601 format. + final String joined; + + /// User confirmation status, true if the user has joined the team or false otherwise. + final bool confirm; + + /// Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. + final bool mfa; + + /// User list of roles + final List roles; + + Membership({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.userId, + required this.userName, + required this.userEmail, + required this.userPhone, + required this.teamId, + required this.teamName, + required this.invited, + required this.joined, + required this.confirm, + required this.mfa, + required this.roles, + }); + + factory Membership.fromMap(Map map) { + return Membership( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + userId: map['userId'].toString(), + userName: map['userName'].toString(), + userEmail: map['userEmail'].toString(), + userPhone: map['userPhone'].toString(), + teamId: map['teamId'].toString(), + teamName: map['teamName'].toString(), + invited: map['invited'].toString(), + joined: map['joined'].toString(), + confirm: map['confirm'], + mfa: map['mfa'], + roles: List.from(map['roles'] ?? []), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "userId": userId, + "userName": userName, + "userEmail": userEmail, + "userPhone": userPhone, + "teamId": teamId, + "teamName": teamName, + "invited": invited, + "joined": joined, + "confirm": confirm, + "mfa": mfa, + "roles": roles, + }; + } } diff --git a/lib/src/models/membership_list.dart b/lib/src/models/membership_list.dart index a0641a28..cc664c9f 100644 --- a/lib/src/models/membership_list.dart +++ b/lib/src/models/membership_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Memberships List class MembershipList implements Model { - /// Total number of memberships that matched your query. - final int total; + /// Total number of memberships that matched your query. + final int total; - /// List of memberships. - final List memberships; + /// List of memberships. + final List memberships; - MembershipList({ - required this.total, - required this.memberships, - }); + MembershipList({ + required this.total, + required this.memberships, + }); - factory MembershipList.fromMap(Map map) { - return MembershipList( - total: map['total'], - memberships: List.from(map['memberships'].map((p) => Membership.fromMap(p))), - ); - } + factory MembershipList.fromMap(Map map) { + return MembershipList( + total: map['total'], + memberships: List.from( + map['memberships'].map((p) => Membership.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "memberships": memberships.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "memberships": memberships.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/message.dart b/lib/src/models/message.dart index d11834b5..affbfdc4 100644 --- a/lib/src/models/message.dart +++ b/lib/src/models/message.dart @@ -2,95 +2,96 @@ part of '../../models.dart'; /// Message class Message implements Model { - /// Message ID. - final String $id; - - /// Message creation time in ISO 8601 format. - final String $createdAt; - - /// Message update date in ISO 8601 format. - final String $updatedAt; - - /// Message provider type. - final String providerType; - - /// Topic IDs set as recipients. - final List topics; - - /// User IDs set as recipients. - final List users; - - /// Target IDs set as recipients. - final List targets; - - /// The scheduled time for message. - final String? scheduledAt; - - /// The time when the message was delivered. - final String? deliveredAt; - - /// Delivery errors if any. - final List? deliveryErrors; - - /// Number of recipients the message was delivered to. - final int deliveredTotal; - - /// Data of the message. - final Map data; - - /// Status of delivery. - final enums.MessageStatus status; - - Message({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.providerType, - required this.topics, - required this.users, - required this.targets, - this.scheduledAt, - this.deliveredAt, - this.deliveryErrors, - required this.deliveredTotal, - required this.data, - required this.status, - }); - - factory Message.fromMap(Map map) { - return Message( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - providerType: map['providerType'].toString(), - topics: List.from(map['topics'] ?? []), - users: List.from(map['users'] ?? []), - targets: List.from(map['targets'] ?? []), - scheduledAt: map['scheduledAt']?.toString(), - deliveredAt: map['deliveredAt']?.toString(), - deliveryErrors: List.from(map['deliveryErrors'] ?? []), - deliveredTotal: map['deliveredTotal'], - data: map['data'], - status: enums.MessageStatus.values.firstWhere((e) => e.value == map['status']), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "providerType": providerType, - "topics": topics, - "users": users, - "targets": targets, - "scheduledAt": scheduledAt, - "deliveredAt": deliveredAt, - "deliveryErrors": deliveryErrors, - "deliveredTotal": deliveredTotal, - "data": data, - "status": status.value, - }; - } + /// Message ID. + final String $id; + + /// Message creation time in ISO 8601 format. + final String $createdAt; + + /// Message update date in ISO 8601 format. + final String $updatedAt; + + /// Message provider type. + final String providerType; + + /// Topic IDs set as recipients. + final List topics; + + /// User IDs set as recipients. + final List users; + + /// Target IDs set as recipients. + final List targets; + + /// The scheduled time for message. + final String? scheduledAt; + + /// The time when the message was delivered. + final String? deliveredAt; + + /// Delivery errors if any. + final List? deliveryErrors; + + /// Number of recipients the message was delivered to. + final int deliveredTotal; + + /// Data of the message. + final Map data; + + /// Status of delivery. + final enums.MessageStatus status; + + Message({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.providerType, + required this.topics, + required this.users, + required this.targets, + this.scheduledAt, + this.deliveredAt, + this.deliveryErrors, + required this.deliveredTotal, + required this.data, + required this.status, + }); + + factory Message.fromMap(Map map) { + return Message( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + providerType: map['providerType'].toString(), + topics: List.from(map['topics'] ?? []), + users: List.from(map['users'] ?? []), + targets: List.from(map['targets'] ?? []), + scheduledAt: map['scheduledAt']?.toString(), + deliveredAt: map['deliveredAt']?.toString(), + deliveryErrors: List.from(map['deliveryErrors'] ?? []), + deliveredTotal: map['deliveredTotal'], + data: map['data'], + status: enums.MessageStatus.values + .firstWhere((e) => e.value == map['status']), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "providerType": providerType, + "topics": topics, + "users": users, + "targets": targets, + "scheduledAt": scheduledAt, + "deliveredAt": deliveredAt, + "deliveryErrors": deliveryErrors, + "deliveredTotal": deliveredTotal, + "data": data, + "status": status.value, + }; + } } diff --git a/lib/src/models/message_list.dart b/lib/src/models/message_list.dart index 16349d41..829d6f71 100644 --- a/lib/src/models/message_list.dart +++ b/lib/src/models/message_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Message list class MessageList implements Model { - /// Total number of messages that matched your query. - final int total; + /// Total number of messages that matched your query. + final int total; - /// List of messages. - final List messages; + /// List of messages. + final List messages; - MessageList({ - required this.total, - required this.messages, - }); + MessageList({ + required this.total, + required this.messages, + }); - factory MessageList.fromMap(Map map) { - return MessageList( - total: map['total'], - messages: List.from(map['messages'].map((p) => Message.fromMap(p))), - ); - } + factory MessageList.fromMap(Map map) { + return MessageList( + total: map['total'], + messages: + List.from(map['messages'].map((p) => Message.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "messages": messages.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "messages": messages.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/mfa_challenge.dart b/lib/src/models/mfa_challenge.dart index 3d2e2335..fa385541 100644 --- a/lib/src/models/mfa_challenge.dart +++ b/lib/src/models/mfa_challenge.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// MFA Challenge class MfaChallenge implements Model { - /// Token ID. - final String $id; + /// Token ID. + final String $id; - /// Token creation date in ISO 8601 format. - final String $createdAt; + /// Token creation date in ISO 8601 format. + final String $createdAt; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Token expiration date in ISO 8601 format. - final String expire; + /// Token expiration date in ISO 8601 format. + final String expire; - MfaChallenge({ - required this.$id, - required this.$createdAt, - required this.userId, - required this.expire, - }); + MfaChallenge({ + required this.$id, + required this.$createdAt, + required this.userId, + required this.expire, + }); - factory MfaChallenge.fromMap(Map map) { - return MfaChallenge( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - userId: map['userId'].toString(), - expire: map['expire'].toString(), - ); - } + factory MfaChallenge.fromMap(Map map) { + return MfaChallenge( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + userId: map['userId'].toString(), + expire: map['expire'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "expire": expire, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "userId": userId, + "expire": expire, + }; + } } diff --git a/lib/src/models/mfa_factors.dart b/lib/src/models/mfa_factors.dart index a7e5fefc..2777de7f 100644 --- a/lib/src/models/mfa_factors.dart +++ b/lib/src/models/mfa_factors.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// MFAFactors class MfaFactors implements Model { - /// Can TOTP be used for MFA challenge for this account. - final bool totp; + /// Can TOTP be used for MFA challenge for this account. + final bool totp; - /// Can phone (SMS) be used for MFA challenge for this account. - final bool phone; + /// Can phone (SMS) be used for MFA challenge for this account. + final bool phone; - /// Can email be used for MFA challenge for this account. - final bool email; + /// Can email be used for MFA challenge for this account. + final bool email; - /// Can recovery code be used for MFA challenge for this account. - final bool recoveryCode; + /// Can recovery code be used for MFA challenge for this account. + final bool recoveryCode; - MfaFactors({ - required this.totp, - required this.phone, - required this.email, - required this.recoveryCode, - }); + MfaFactors({ + required this.totp, + required this.phone, + required this.email, + required this.recoveryCode, + }); - factory MfaFactors.fromMap(Map map) { - return MfaFactors( - totp: map['totp'], - phone: map['phone'], - email: map['email'], - recoveryCode: map['recoveryCode'], - ); - } + factory MfaFactors.fromMap(Map map) { + return MfaFactors( + totp: map['totp'], + phone: map['phone'], + email: map['email'], + recoveryCode: map['recoveryCode'], + ); + } - @override - Map toMap() { - return { - "totp": totp, - "phone": phone, - "email": email, - "recoveryCode": recoveryCode, - }; - } + @override + Map toMap() { + return { + "totp": totp, + "phone": phone, + "email": email, + "recoveryCode": recoveryCode, + }; + } } diff --git a/lib/src/models/mfa_recovery_codes.dart b/lib/src/models/mfa_recovery_codes.dart index 33036476..864a5db8 100644 --- a/lib/src/models/mfa_recovery_codes.dart +++ b/lib/src/models/mfa_recovery_codes.dart @@ -2,23 +2,23 @@ part of '../../models.dart'; /// MFA Recovery Codes class MfaRecoveryCodes implements Model { - /// Recovery codes. - final List recoveryCodes; + /// Recovery codes. + final List recoveryCodes; - MfaRecoveryCodes({ - required this.recoveryCodes, - }); + MfaRecoveryCodes({ + required this.recoveryCodes, + }); - factory MfaRecoveryCodes.fromMap(Map map) { - return MfaRecoveryCodes( - recoveryCodes: List.from(map['recoveryCodes'] ?? []), - ); - } + factory MfaRecoveryCodes.fromMap(Map map) { + return MfaRecoveryCodes( + recoveryCodes: List.from(map['recoveryCodes'] ?? []), + ); + } - @override - Map toMap() { - return { - "recoveryCodes": recoveryCodes, - }; - } + @override + Map toMap() { + return { + "recoveryCodes": recoveryCodes, + }; + } } diff --git a/lib/src/models/mfa_type.dart b/lib/src/models/mfa_type.dart index 05cab363..fe5327fc 100644 --- a/lib/src/models/mfa_type.dart +++ b/lib/src/models/mfa_type.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// MFAType class MfaType implements Model { - /// Secret token used for TOTP factor. - final String secret; + /// Secret token used for TOTP factor. + final String secret; - /// URI for authenticator apps. - final String uri; + /// URI for authenticator apps. + final String uri; - MfaType({ - required this.secret, - required this.uri, - }); + MfaType({ + required this.secret, + required this.uri, + }); - factory MfaType.fromMap(Map map) { - return MfaType( - secret: map['secret'].toString(), - uri: map['uri'].toString(), - ); - } + factory MfaType.fromMap(Map map) { + return MfaType( + secret: map['secret'].toString(), + uri: map['uri'].toString(), + ); + } - @override - Map toMap() { - return { - "secret": secret, - "uri": uri, - }; - } + @override + Map toMap() { + return { + "secret": secret, + "uri": uri, + }; + } } diff --git a/lib/src/models/mock_number.dart b/lib/src/models/mock_number.dart index b8e9b525..0f256952 100644 --- a/lib/src/models/mock_number.dart +++ b/lib/src/models/mock_number.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// Mock Number class MockNumber implements Model { - /// Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. - final String number; + /// Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. + final String number; - /// Mock OTP for the number. - final String otp; + /// Mock OTP for the number. + final String otp; - /// Attribute creation date in ISO 8601 format. - final String $createdAt; + /// Attribute creation date in ISO 8601 format. + final String $createdAt; - /// Attribute update date in ISO 8601 format. - final String $updatedAt; + /// Attribute update date in ISO 8601 format. + final String $updatedAt; - MockNumber({ - required this.number, - required this.otp, - required this.$createdAt, - required this.$updatedAt, - }); + MockNumber({ + required this.number, + required this.otp, + required this.$createdAt, + required this.$updatedAt, + }); - factory MockNumber.fromMap(Map map) { - return MockNumber( - number: map['number'].toString(), - otp: map['otp'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - ); - } + factory MockNumber.fromMap(Map map) { + return MockNumber( + number: map['number'].toString(), + otp: map['otp'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + ); + } - @override - Map toMap() { - return { - "number": number, - "otp": otp, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - }; - } + @override + Map toMap() { + return { + "number": number, + "otp": otp, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + }; + } } diff --git a/lib/src/models/mock_number_list.dart b/lib/src/models/mock_number_list.dart index f4c07f58..d3e421b7 100644 --- a/lib/src/models/mock_number_list.dart +++ b/lib/src/models/mock_number_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Mock Numbers List class MockNumberList implements Model { - /// Total number of mockNumbers that matched your query. - final int total; + /// Total number of mockNumbers that matched your query. + final int total; - /// List of mockNumbers. - final List mockNumbers; + /// List of mockNumbers. + final List mockNumbers; - MockNumberList({ - required this.total, - required this.mockNumbers, - }); + MockNumberList({ + required this.total, + required this.mockNumbers, + }); - factory MockNumberList.fromMap(Map map) { - return MockNumberList( - total: map['total'], - mockNumbers: List.from(map['mockNumbers'].map((p) => MockNumber.fromMap(p))), - ); - } + factory MockNumberList.fromMap(Map map) { + return MockNumberList( + total: map['total'], + mockNumbers: List.from( + map['mockNumbers'].map((p) => MockNumber.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "mockNumbers": mockNumbers.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "mockNumbers": mockNumbers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/model.dart b/lib/src/models/model.dart index 48e5b84a..f810a35b 100644 --- a/lib/src/models/model.dart +++ b/lib/src/models/model.dart @@ -2,4 +2,4 @@ part of '../../models.dart'; abstract class Model { Map toMap(); -} \ No newline at end of file +} diff --git a/lib/src/models/o_auth2_amazon.dart b/lib/src/models/o_auth2_amazon.dart index a2675157..c3d75928 100644 --- a/lib/src/models/o_auth2_amazon.dart +++ b/lib/src/models/o_auth2_amazon.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Amazon class OAuth2Amazon implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Amazon OAuth2 client ID. - final String clientId; + /// Amazon OAuth2 client ID. + final String clientId; - /// Amazon OAuth2 client secret. - final String clientSecret; + /// Amazon OAuth2 client secret. + final String clientSecret; - OAuth2Amazon({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Amazon({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Amazon.fromMap(Map map) { - return OAuth2Amazon( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Amazon.fromMap(Map map) { + return OAuth2Amazon( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_apple.dart b/lib/src/models/o_auth2_apple.dart index 8fbc0e44..d37e1d35 100644 --- a/lib/src/models/o_auth2_apple.dart +++ b/lib/src/models/o_auth2_apple.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// OAuth2Apple class OAuth2Apple implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// Apple OAuth2 service ID. - final String serviceId; - - /// Apple OAuth2 key ID. - final String keyId; - - /// Apple OAuth2 team ID. - final String teamId; - - /// Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. - final String p8File; - - OAuth2Apple({ - required this.$id, - required this.enabled, - required this.serviceId, - required this.keyId, - required this.teamId, - required this.p8File, - }); - - factory OAuth2Apple.fromMap(Map map) { - return OAuth2Apple( - $id: map['\$id'].toString(), - enabled: map['enabled'], - serviceId: map['serviceId'].toString(), - keyId: map['keyId'].toString(), - teamId: map['teamId'].toString(), - p8File: map['p8File'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "serviceId": serviceId, - "keyId": keyId, - "teamId": teamId, - "p8File": p8File, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Apple OAuth2 service ID. + final String serviceId; + + /// Apple OAuth2 key ID. + final String keyId; + + /// Apple OAuth2 team ID. + final String teamId; + + /// Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. + final String p8File; + + OAuth2Apple({ + required this.$id, + required this.enabled, + required this.serviceId, + required this.keyId, + required this.teamId, + required this.p8File, + }); + + factory OAuth2Apple.fromMap(Map map) { + return OAuth2Apple( + $id: map['\$id'].toString(), + enabled: map['enabled'], + serviceId: map['serviceId'].toString(), + keyId: map['keyId'].toString(), + teamId: map['teamId'].toString(), + p8File: map['p8File'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "serviceId": serviceId, + "keyId": keyId, + "teamId": teamId, + "p8File": p8File, + }; + } } diff --git a/lib/src/models/o_auth2_auth0.dart b/lib/src/models/o_auth2_auth0.dart index 2ccff413..3e7083da 100644 --- a/lib/src/models/o_auth2_auth0.dart +++ b/lib/src/models/o_auth2_auth0.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// OAuth2Auth0 class OAuth2Auth0 implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// Auth0 OAuth2 client ID. - final String clientId; - - /// Auth0 OAuth2 client secret. - final String clientSecret; - - /// Auth0 OAuth2 endpoint domain. - final String endpoint; - - OAuth2Auth0({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - required this.endpoint, - }); - - factory OAuth2Auth0.fromMap(Map map) { - return OAuth2Auth0( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - endpoint: map['endpoint'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - "endpoint": endpoint, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Auth0 OAuth2 client ID. + final String clientId; + + /// Auth0 OAuth2 client secret. + final String clientSecret; + + /// Auth0 OAuth2 endpoint domain. + final String endpoint; + + OAuth2Auth0({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2Auth0.fromMap(Map map) { + return OAuth2Auth0( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } } diff --git a/lib/src/models/o_auth2_authentik.dart b/lib/src/models/o_auth2_authentik.dart index 2f72d83a..52896e9c 100644 --- a/lib/src/models/o_auth2_authentik.dart +++ b/lib/src/models/o_auth2_authentik.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// OAuth2Authentik class OAuth2Authentik implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// Authentik OAuth2 client ID. - final String clientId; - - /// Authentik OAuth2 client secret. - final String clientSecret; - - /// Authentik OAuth2 endpoint domain. - final String endpoint; - - OAuth2Authentik({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - required this.endpoint, - }); - - factory OAuth2Authentik.fromMap(Map map) { - return OAuth2Authentik( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - endpoint: map['endpoint'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - "endpoint": endpoint, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Authentik OAuth2 client ID. + final String clientId; + + /// Authentik OAuth2 client secret. + final String clientSecret; + + /// Authentik OAuth2 endpoint domain. + final String endpoint; + + OAuth2Authentik({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2Authentik.fromMap(Map map) { + return OAuth2Authentik( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } } diff --git a/lib/src/models/o_auth2_autodesk.dart b/lib/src/models/o_auth2_autodesk.dart index bb187b20..d3ed8ddd 100644 --- a/lib/src/models/o_auth2_autodesk.dart +++ b/lib/src/models/o_auth2_autodesk.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Autodesk class OAuth2Autodesk implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Autodesk OAuth2 client ID. - final String clientId; + /// Autodesk OAuth2 client ID. + final String clientId; - /// Autodesk OAuth2 client secret. - final String clientSecret; + /// Autodesk OAuth2 client secret. + final String clientSecret; - OAuth2Autodesk({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Autodesk({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Autodesk.fromMap(Map map) { - return OAuth2Autodesk( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Autodesk.fromMap(Map map) { + return OAuth2Autodesk( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_bitbucket.dart b/lib/src/models/o_auth2_bitbucket.dart index 218ba149..dfd6ab00 100644 --- a/lib/src/models/o_auth2_bitbucket.dart +++ b/lib/src/models/o_auth2_bitbucket.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Bitbucket class OAuth2Bitbucket implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Bitbucket OAuth2 key. - final String key; + /// Bitbucket OAuth2 key. + final String key; - /// Bitbucket OAuth2 secret. - final String secret; + /// Bitbucket OAuth2 secret. + final String secret; - OAuth2Bitbucket({ - required this.$id, - required this.enabled, - required this.key, - required this.secret, - }); + OAuth2Bitbucket({ + required this.$id, + required this.enabled, + required this.key, + required this.secret, + }); - factory OAuth2Bitbucket.fromMap(Map map) { - return OAuth2Bitbucket( - $id: map['\$id'].toString(), - enabled: map['enabled'], - key: map['key'].toString(), - secret: map['secret'].toString(), - ); - } + factory OAuth2Bitbucket.fromMap(Map map) { + return OAuth2Bitbucket( + $id: map['\$id'].toString(), + enabled: map['enabled'], + key: map['key'].toString(), + secret: map['secret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "key": key, - "secret": secret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "key": key, + "secret": secret, + }; + } } diff --git a/lib/src/models/o_auth2_bitly.dart b/lib/src/models/o_auth2_bitly.dart index 466083b4..0ab7d716 100644 --- a/lib/src/models/o_auth2_bitly.dart +++ b/lib/src/models/o_auth2_bitly.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Bitly class OAuth2Bitly implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Bitly OAuth2 client ID. - final String clientId; + /// Bitly OAuth2 client ID. + final String clientId; - /// Bitly OAuth2 client secret. - final String clientSecret; + /// Bitly OAuth2 client secret. + final String clientSecret; - OAuth2Bitly({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Bitly({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Bitly.fromMap(Map map) { - return OAuth2Bitly( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Bitly.fromMap(Map map) { + return OAuth2Bitly( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_box.dart b/lib/src/models/o_auth2_box.dart index 05c41eff..2c4b0f9d 100644 --- a/lib/src/models/o_auth2_box.dart +++ b/lib/src/models/o_auth2_box.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Box class OAuth2Box implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Box OAuth2 client ID. - final String clientId; + /// Box OAuth2 client ID. + final String clientId; - /// Box OAuth2 client secret. - final String clientSecret; + /// Box OAuth2 client secret. + final String clientSecret; - OAuth2Box({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Box({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Box.fromMap(Map map) { - return OAuth2Box( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Box.fromMap(Map map) { + return OAuth2Box( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_dailymotion.dart b/lib/src/models/o_auth2_dailymotion.dart index 8936d374..b91c29a0 100644 --- a/lib/src/models/o_auth2_dailymotion.dart +++ b/lib/src/models/o_auth2_dailymotion.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Dailymotion class OAuth2Dailymotion implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Dailymotion OAuth2 API key. - final String apiKey; + /// Dailymotion OAuth2 API key. + final String apiKey; - /// Dailymotion OAuth2 API secret. - final String apiSecret; + /// Dailymotion OAuth2 API secret. + final String apiSecret; - OAuth2Dailymotion({ - required this.$id, - required this.enabled, - required this.apiKey, - required this.apiSecret, - }); + OAuth2Dailymotion({ + required this.$id, + required this.enabled, + required this.apiKey, + required this.apiSecret, + }); - factory OAuth2Dailymotion.fromMap(Map map) { - return OAuth2Dailymotion( - $id: map['\$id'].toString(), - enabled: map['enabled'], - apiKey: map['apiKey'].toString(), - apiSecret: map['apiSecret'].toString(), - ); - } + factory OAuth2Dailymotion.fromMap(Map map) { + return OAuth2Dailymotion( + $id: map['\$id'].toString(), + enabled: map['enabled'], + apiKey: map['apiKey'].toString(), + apiSecret: map['apiSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "apiKey": apiKey, - "apiSecret": apiSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "apiKey": apiKey, + "apiSecret": apiSecret, + }; + } } diff --git a/lib/src/models/o_auth2_discord.dart b/lib/src/models/o_auth2_discord.dart index ee688578..6ca9e12f 100644 --- a/lib/src/models/o_auth2_discord.dart +++ b/lib/src/models/o_auth2_discord.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Discord class OAuth2Discord implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Discord OAuth2 client ID. - final String clientId; + /// Discord OAuth2 client ID. + final String clientId; - /// Discord OAuth2 client secret. - final String clientSecret; + /// Discord OAuth2 client secret. + final String clientSecret; - OAuth2Discord({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Discord({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Discord.fromMap(Map map) { - return OAuth2Discord( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Discord.fromMap(Map map) { + return OAuth2Discord( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_disqus.dart b/lib/src/models/o_auth2_disqus.dart index 55b6fbf2..11f80f80 100644 --- a/lib/src/models/o_auth2_disqus.dart +++ b/lib/src/models/o_auth2_disqus.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Disqus class OAuth2Disqus implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Disqus OAuth2 public key. - final String publicKey; + /// Disqus OAuth2 public key. + final String publicKey; - /// Disqus OAuth2 secret key. - final String secretKey; + /// Disqus OAuth2 secret key. + final String secretKey; - OAuth2Disqus({ - required this.$id, - required this.enabled, - required this.publicKey, - required this.secretKey, - }); + OAuth2Disqus({ + required this.$id, + required this.enabled, + required this.publicKey, + required this.secretKey, + }); - factory OAuth2Disqus.fromMap(Map map) { - return OAuth2Disqus( - $id: map['\$id'].toString(), - enabled: map['enabled'], - publicKey: map['publicKey'].toString(), - secretKey: map['secretKey'].toString(), - ); - } + factory OAuth2Disqus.fromMap(Map map) { + return OAuth2Disqus( + $id: map['\$id'].toString(), + enabled: map['enabled'], + publicKey: map['publicKey'].toString(), + secretKey: map['secretKey'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "publicKey": publicKey, - "secretKey": secretKey, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "publicKey": publicKey, + "secretKey": secretKey, + }; + } } diff --git a/lib/src/models/o_auth2_dropbox.dart b/lib/src/models/o_auth2_dropbox.dart index 883bb9dd..0ae842fb 100644 --- a/lib/src/models/o_auth2_dropbox.dart +++ b/lib/src/models/o_auth2_dropbox.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Dropbox class OAuth2Dropbox implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Dropbox OAuth2 app key. - final String appKey; + /// Dropbox OAuth2 app key. + final String appKey; - /// Dropbox OAuth2 app secret. - final String appSecret; + /// Dropbox OAuth2 app secret. + final String appSecret; - OAuth2Dropbox({ - required this.$id, - required this.enabled, - required this.appKey, - required this.appSecret, - }); + OAuth2Dropbox({ + required this.$id, + required this.enabled, + required this.appKey, + required this.appSecret, + }); - factory OAuth2Dropbox.fromMap(Map map) { - return OAuth2Dropbox( - $id: map['\$id'].toString(), - enabled: map['enabled'], - appKey: map['appKey'].toString(), - appSecret: map['appSecret'].toString(), - ); - } + factory OAuth2Dropbox.fromMap(Map map) { + return OAuth2Dropbox( + $id: map['\$id'].toString(), + enabled: map['enabled'], + appKey: map['appKey'].toString(), + appSecret: map['appSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "appKey": appKey, - "appSecret": appSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "appKey": appKey, + "appSecret": appSecret, + }; + } } diff --git a/lib/src/models/o_auth2_etsy.dart b/lib/src/models/o_auth2_etsy.dart index 7aedaffc..f166e516 100644 --- a/lib/src/models/o_auth2_etsy.dart +++ b/lib/src/models/o_auth2_etsy.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Etsy class OAuth2Etsy implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Etsy OAuth2 keystring. - final String keyString; + /// Etsy OAuth2 keystring. + final String keyString; - /// Etsy OAuth2 shared secret. - final String sharedSecret; + /// Etsy OAuth2 shared secret. + final String sharedSecret; - OAuth2Etsy({ - required this.$id, - required this.enabled, - required this.keyString, - required this.sharedSecret, - }); + OAuth2Etsy({ + required this.$id, + required this.enabled, + required this.keyString, + required this.sharedSecret, + }); - factory OAuth2Etsy.fromMap(Map map) { - return OAuth2Etsy( - $id: map['\$id'].toString(), - enabled: map['enabled'], - keyString: map['keyString'].toString(), - sharedSecret: map['sharedSecret'].toString(), - ); - } + factory OAuth2Etsy.fromMap(Map map) { + return OAuth2Etsy( + $id: map['\$id'].toString(), + enabled: map['enabled'], + keyString: map['keyString'].toString(), + sharedSecret: map['sharedSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "keyString": keyString, - "sharedSecret": sharedSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "keyString": keyString, + "sharedSecret": sharedSecret, + }; + } } diff --git a/lib/src/models/o_auth2_facebook.dart b/lib/src/models/o_auth2_facebook.dart index b6728d64..3b59319e 100644 --- a/lib/src/models/o_auth2_facebook.dart +++ b/lib/src/models/o_auth2_facebook.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Facebook class OAuth2Facebook implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Facebook OAuth2 app ID. - final String appId; + /// Facebook OAuth2 app ID. + final String appId; - /// Facebook OAuth2 app secret. - final String appSecret; + /// Facebook OAuth2 app secret. + final String appSecret; - OAuth2Facebook({ - required this.$id, - required this.enabled, - required this.appId, - required this.appSecret, - }); + OAuth2Facebook({ + required this.$id, + required this.enabled, + required this.appId, + required this.appSecret, + }); - factory OAuth2Facebook.fromMap(Map map) { - return OAuth2Facebook( - $id: map['\$id'].toString(), - enabled: map['enabled'], - appId: map['appId'].toString(), - appSecret: map['appSecret'].toString(), - ); - } + factory OAuth2Facebook.fromMap(Map map) { + return OAuth2Facebook( + $id: map['\$id'].toString(), + enabled: map['enabled'], + appId: map['appId'].toString(), + appSecret: map['appSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "appId": appId, - "appSecret": appSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "appId": appId, + "appSecret": appSecret, + }; + } } diff --git a/lib/src/models/o_auth2_figma.dart b/lib/src/models/o_auth2_figma.dart index f1b9a53e..446821e1 100644 --- a/lib/src/models/o_auth2_figma.dart +++ b/lib/src/models/o_auth2_figma.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Figma class OAuth2Figma implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Figma OAuth2 client ID. - final String clientId; + /// Figma OAuth2 client ID. + final String clientId; - /// Figma OAuth2 client secret. - final String clientSecret; + /// Figma OAuth2 client secret. + final String clientSecret; - OAuth2Figma({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Figma({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Figma.fromMap(Map map) { - return OAuth2Figma( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Figma.fromMap(Map map) { + return OAuth2Figma( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_fusion_auth.dart b/lib/src/models/o_auth2_fusion_auth.dart index 48fc42b2..91944e9b 100644 --- a/lib/src/models/o_auth2_fusion_auth.dart +++ b/lib/src/models/o_auth2_fusion_auth.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// OAuth2FusionAuth class OAuth2FusionAuth implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// FusionAuth OAuth2 client ID. - final String clientId; - - /// FusionAuth OAuth2 client secret. - final String clientSecret; - - /// FusionAuth OAuth2 endpoint domain. - final String endpoint; - - OAuth2FusionAuth({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - required this.endpoint, - }); - - factory OAuth2FusionAuth.fromMap(Map map) { - return OAuth2FusionAuth( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - endpoint: map['endpoint'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - "endpoint": endpoint, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// FusionAuth OAuth2 client ID. + final String clientId; + + /// FusionAuth OAuth2 client secret. + final String clientSecret; + + /// FusionAuth OAuth2 endpoint domain. + final String endpoint; + + OAuth2FusionAuth({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + }); + + factory OAuth2FusionAuth.fromMap(Map map) { + return OAuth2FusionAuth( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + }; + } } diff --git a/lib/src/models/o_auth2_github.dart b/lib/src/models/o_auth2_github.dart index 99b40862..d62e55da 100644 --- a/lib/src/models/o_auth2_github.dart +++ b/lib/src/models/o_auth2_github.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2GitHub class OAuth2Github implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. - final String clientId; + /// GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. + final String clientId; - /// GitHub OAuth2 client secret. - final String clientSecret; + /// GitHub OAuth2 client secret. + final String clientSecret; - OAuth2Github({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Github({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Github.fromMap(Map map) { - return OAuth2Github( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Github.fromMap(Map map) { + return OAuth2Github( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_gitlab.dart b/lib/src/models/o_auth2_gitlab.dart index bfa92437..5418c044 100644 --- a/lib/src/models/o_auth2_gitlab.dart +++ b/lib/src/models/o_auth2_gitlab.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// OAuth2Gitlab class OAuth2Gitlab implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// GitLab OAuth2 application ID. - final String applicationId; - - /// GitLab OAuth2 secret. - final String secret; - - /// GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. - final String endpoint; - - OAuth2Gitlab({ - required this.$id, - required this.enabled, - required this.applicationId, - required this.secret, - required this.endpoint, - }); - - factory OAuth2Gitlab.fromMap(Map map) { - return OAuth2Gitlab( - $id: map['\$id'].toString(), - enabled: map['enabled'], - applicationId: map['applicationId'].toString(), - secret: map['secret'].toString(), - endpoint: map['endpoint'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "applicationId": applicationId, - "secret": secret, - "endpoint": endpoint, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// GitLab OAuth2 application ID. + final String applicationId; + + /// GitLab OAuth2 secret. + final String secret; + + /// GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. + final String endpoint; + + OAuth2Gitlab({ + required this.$id, + required this.enabled, + required this.applicationId, + required this.secret, + required this.endpoint, + }); + + factory OAuth2Gitlab.fromMap(Map map) { + return OAuth2Gitlab( + $id: map['\$id'].toString(), + enabled: map['enabled'], + applicationId: map['applicationId'].toString(), + secret: map['secret'].toString(), + endpoint: map['endpoint'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "applicationId": applicationId, + "secret": secret, + "endpoint": endpoint, + }; + } } diff --git a/lib/src/models/o_auth2_google.dart b/lib/src/models/o_auth2_google.dart index a541934b..ec156dfa 100644 --- a/lib/src/models/o_auth2_google.dart +++ b/lib/src/models/o_auth2_google.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Google class OAuth2Google implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Google OAuth2 client ID. - final String clientId; + /// Google OAuth2 client ID. + final String clientId; - /// Google OAuth2 client secret. - final String clientSecret; + /// Google OAuth2 client secret. + final String clientSecret; - OAuth2Google({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Google({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Google.fromMap(Map map) { - return OAuth2Google( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Google.fromMap(Map map) { + return OAuth2Google( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_keycloak.dart b/lib/src/models/o_auth2_keycloak.dart index 890cfad9..d5b16a7f 100644 --- a/lib/src/models/o_auth2_keycloak.dart +++ b/lib/src/models/o_auth2_keycloak.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// OAuth2Keycloak class OAuth2Keycloak implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// Keycloak OAuth2 client ID. - final String clientId; - - /// Keycloak OAuth2 client secret. - final String clientSecret; - - /// Keycloak OAuth2 endpoint domain. - final String endpoint; - - /// Keycloak OAuth2 realm name. - final String realmName; - - OAuth2Keycloak({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - required this.endpoint, - required this.realmName, - }); - - factory OAuth2Keycloak.fromMap(Map map) { - return OAuth2Keycloak( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - endpoint: map['endpoint'].toString(), - realmName: map['realmName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - "endpoint": endpoint, - "realmName": realmName, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Keycloak OAuth2 client ID. + final String clientId; + + /// Keycloak OAuth2 client secret. + final String clientSecret; + + /// Keycloak OAuth2 endpoint domain. + final String endpoint; + + /// Keycloak OAuth2 realm name. + final String realmName; + + OAuth2Keycloak({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.endpoint, + required this.realmName, + }); + + factory OAuth2Keycloak.fromMap(Map map) { + return OAuth2Keycloak( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + endpoint: map['endpoint'].toString(), + realmName: map['realmName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "endpoint": endpoint, + "realmName": realmName, + }; + } } diff --git a/lib/src/models/o_auth2_kick.dart b/lib/src/models/o_auth2_kick.dart index 3cf9fce5..2c9a10e4 100644 --- a/lib/src/models/o_auth2_kick.dart +++ b/lib/src/models/o_auth2_kick.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Kick class OAuth2Kick implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Kick OAuth2 client ID. - final String clientId; + /// Kick OAuth2 client ID. + final String clientId; - /// Kick OAuth2 client secret. - final String clientSecret; + /// Kick OAuth2 client secret. + final String clientSecret; - OAuth2Kick({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Kick({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Kick.fromMap(Map map) { - return OAuth2Kick( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Kick.fromMap(Map map) { + return OAuth2Kick( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_linkedin.dart b/lib/src/models/o_auth2_linkedin.dart index dd44dacf..cff3afb6 100644 --- a/lib/src/models/o_auth2_linkedin.dart +++ b/lib/src/models/o_auth2_linkedin.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Linkedin class OAuth2Linkedin implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// LinkedIn OAuth2 client ID. - final String clientId; + /// LinkedIn OAuth2 client ID. + final String clientId; - /// LinkedIn OAuth2 primary client secret. - final String primaryClientSecret; + /// LinkedIn OAuth2 primary client secret. + final String primaryClientSecret; - OAuth2Linkedin({ - required this.$id, - required this.enabled, - required this.clientId, - required this.primaryClientSecret, - }); + OAuth2Linkedin({ + required this.$id, + required this.enabled, + required this.clientId, + required this.primaryClientSecret, + }); - factory OAuth2Linkedin.fromMap(Map map) { - return OAuth2Linkedin( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - primaryClientSecret: map['primaryClientSecret'].toString(), - ); - } + factory OAuth2Linkedin.fromMap(Map map) { + return OAuth2Linkedin( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + primaryClientSecret: map['primaryClientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "primaryClientSecret": primaryClientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "primaryClientSecret": primaryClientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_microsoft.dart b/lib/src/models/o_auth2_microsoft.dart index eb2ec09c..e6b4122a 100644 --- a/lib/src/models/o_auth2_microsoft.dart +++ b/lib/src/models/o_auth2_microsoft.dart @@ -2,47 +2,47 @@ part of '../../models.dart'; /// OAuth2Microsoft class OAuth2Microsoft implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// Microsoft OAuth2 application ID. - final String applicationId; - - /// Microsoft OAuth2 application secret. - final String applicationSecret; - - /// Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. - final String tenant; - - OAuth2Microsoft({ - required this.$id, - required this.enabled, - required this.applicationId, - required this.applicationSecret, - required this.tenant, - }); - - factory OAuth2Microsoft.fromMap(Map map) { - return OAuth2Microsoft( - $id: map['\$id'].toString(), - enabled: map['enabled'], - applicationId: map['applicationId'].toString(), - applicationSecret: map['applicationSecret'].toString(), - tenant: map['tenant'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "applicationId": applicationId, - "applicationSecret": applicationSecret, - "tenant": tenant, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Microsoft OAuth2 application ID. + final String applicationId; + + /// Microsoft OAuth2 application secret. + final String applicationSecret; + + /// Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. + final String tenant; + + OAuth2Microsoft({ + required this.$id, + required this.enabled, + required this.applicationId, + required this.applicationSecret, + required this.tenant, + }); + + factory OAuth2Microsoft.fromMap(Map map) { + return OAuth2Microsoft( + $id: map['\$id'].toString(), + enabled: map['enabled'], + applicationId: map['applicationId'].toString(), + applicationSecret: map['applicationSecret'].toString(), + tenant: map['tenant'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "applicationId": applicationId, + "applicationSecret": applicationSecret, + "tenant": tenant, + }; + } } diff --git a/lib/src/models/o_auth2_notion.dart b/lib/src/models/o_auth2_notion.dart index 92491204..534a7ba7 100644 --- a/lib/src/models/o_auth2_notion.dart +++ b/lib/src/models/o_auth2_notion.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Notion class OAuth2Notion implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Notion OAuth2 client ID. - final String oauthClientId; + /// Notion OAuth2 client ID. + final String oauthClientId; - /// Notion OAuth2 client secret. - final String oauthClientSecret; + /// Notion OAuth2 client secret. + final String oauthClientSecret; - OAuth2Notion({ - required this.$id, - required this.enabled, - required this.oauthClientId, - required this.oauthClientSecret, - }); + OAuth2Notion({ + required this.$id, + required this.enabled, + required this.oauthClientId, + required this.oauthClientSecret, + }); - factory OAuth2Notion.fromMap(Map map) { - return OAuth2Notion( - $id: map['\$id'].toString(), - enabled: map['enabled'], - oauthClientId: map['oauthClientId'].toString(), - oauthClientSecret: map['oauthClientSecret'].toString(), - ); - } + factory OAuth2Notion.fromMap(Map map) { + return OAuth2Notion( + $id: map['\$id'].toString(), + enabled: map['enabled'], + oauthClientId: map['oauthClientId'].toString(), + oauthClientSecret: map['oauthClientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "oauthClientId": oauthClientId, - "oauthClientSecret": oauthClientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "oauthClientId": oauthClientId, + "oauthClientSecret": oauthClientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_oidc.dart b/lib/src/models/o_auth2_oidc.dart index 4bb1312b..99537da7 100644 --- a/lib/src/models/o_auth2_oidc.dart +++ b/lib/src/models/o_auth2_oidc.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// OAuth2Oidc class OAuth2Oidc implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// OpenID Connect OAuth2 client ID. - final String clientId; + /// OpenID Connect OAuth2 client ID. + final String clientId; - /// OpenID Connect OAuth2 client secret. - final String clientSecret; + /// OpenID Connect OAuth2 client secret. + final String clientSecret; - /// OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. - final String wellKnownURL; + /// OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. + final String wellKnownURL; - /// OpenID Connect authorization endpoint URL. - final String authorizationURL; + /// OpenID Connect authorization endpoint URL. + final String authorizationURL; - /// OpenID Connect token endpoint URL. - final String tokenURL; + /// OpenID Connect token endpoint URL. + final String tokenURL; - /// OpenID Connect user info endpoint URL. - final String userInfoURL; + /// OpenID Connect user info endpoint URL. + final String userInfoURL; - OAuth2Oidc({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - required this.wellKnownURL, - required this.authorizationURL, - required this.tokenURL, - required this.userInfoURL, - }); + OAuth2Oidc({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.wellKnownURL, + required this.authorizationURL, + required this.tokenURL, + required this.userInfoURL, + }); - factory OAuth2Oidc.fromMap(Map map) { - return OAuth2Oidc( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - wellKnownURL: map['wellKnownURL'].toString(), - authorizationURL: map['authorizationURL'].toString(), - tokenURL: map['tokenURL'].toString(), - userInfoURL: map['userInfoURL'].toString(), - ); - } + factory OAuth2Oidc.fromMap(Map map) { + return OAuth2Oidc( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + wellKnownURL: map['wellKnownURL'].toString(), + authorizationURL: map['authorizationURL'].toString(), + tokenURL: map['tokenURL'].toString(), + userInfoURL: map['userInfoURL'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - "wellKnownURL": wellKnownURL, - "authorizationURL": authorizationURL, - "tokenURL": tokenURL, - "userInfoURL": userInfoURL, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "wellKnownURL": wellKnownURL, + "authorizationURL": authorizationURL, + "tokenURL": tokenURL, + "userInfoURL": userInfoURL, + }; + } } diff --git a/lib/src/models/o_auth2_okta.dart b/lib/src/models/o_auth2_okta.dart index 046801f3..0a5bade7 100644 --- a/lib/src/models/o_auth2_okta.dart +++ b/lib/src/models/o_auth2_okta.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// OAuth2Okta class OAuth2Okta implements Model { - /// OAuth2 provider ID. - final String $id; - - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; - - /// Okta OAuth2 client ID. - final String clientId; - - /// Okta OAuth2 client secret. - final String clientSecret; - - /// Okta OAuth2 domain. - final String domain; - - /// Okta OAuth2 authorization server ID. - final String authorizationServerId; - - OAuth2Okta({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - required this.domain, - required this.authorizationServerId, - }); - - factory OAuth2Okta.fromMap(Map map) { - return OAuth2Okta( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - domain: map['domain'].toString(), - authorizationServerId: map['authorizationServerId'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - "domain": domain, - "authorizationServerId": authorizationServerId, - }; - } + /// OAuth2 provider ID. + final String $id; + + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; + + /// Okta OAuth2 client ID. + final String clientId; + + /// Okta OAuth2 client secret. + final String clientSecret; + + /// Okta OAuth2 domain. + final String domain; + + /// Okta OAuth2 authorization server ID. + final String authorizationServerId; + + OAuth2Okta({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + required this.domain, + required this.authorizationServerId, + }); + + factory OAuth2Okta.fromMap(Map map) { + return OAuth2Okta( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + domain: map['domain'].toString(), + authorizationServerId: map['authorizationServerId'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + "domain": domain, + "authorizationServerId": authorizationServerId, + }; + } } diff --git a/lib/src/models/o_auth2_paypal.dart b/lib/src/models/o_auth2_paypal.dart index 1d87c582..eb7be823 100644 --- a/lib/src/models/o_auth2_paypal.dart +++ b/lib/src/models/o_auth2_paypal.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Paypal class OAuth2Paypal implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// PayPal OAuth2 client ID. - final String clientId; + /// PayPal OAuth2 client ID. + final String clientId; - /// PayPal OAuth2 secret key. - final String secretKey; + /// PayPal OAuth2 secret key. + final String secretKey; - OAuth2Paypal({ - required this.$id, - required this.enabled, - required this.clientId, - required this.secretKey, - }); + OAuth2Paypal({ + required this.$id, + required this.enabled, + required this.clientId, + required this.secretKey, + }); - factory OAuth2Paypal.fromMap(Map map) { - return OAuth2Paypal( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - secretKey: map['secretKey'].toString(), - ); - } + factory OAuth2Paypal.fromMap(Map map) { + return OAuth2Paypal( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + secretKey: map['secretKey'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "secretKey": secretKey, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "secretKey": secretKey, + }; + } } diff --git a/lib/src/models/o_auth2_podio.dart b/lib/src/models/o_auth2_podio.dart index cdf9504a..36aaa935 100644 --- a/lib/src/models/o_auth2_podio.dart +++ b/lib/src/models/o_auth2_podio.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Podio class OAuth2Podio implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Podio OAuth2 client ID. - final String clientId; + /// Podio OAuth2 client ID. + final String clientId; - /// Podio OAuth2 client secret. - final String clientSecret; + /// Podio OAuth2 client secret. + final String clientSecret; - OAuth2Podio({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Podio({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Podio.fromMap(Map map) { - return OAuth2Podio( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Podio.fromMap(Map map) { + return OAuth2Podio( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_provider_list.dart b/lib/src/models/o_auth2_provider_list.dart index e02e9bd3..46c9dd1e 100644 --- a/lib/src/models/o_auth2_provider_list.dart +++ b/lib/src/models/o_auth2_provider_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// OAuth2 Providers List class OAuth2ProviderList implements Model { - /// Total number of OAuth2 providers in the given project. - final int total; + /// Total number of OAuth2 providers in the given project. + final int total; - /// List of OAuth2 providers. - final List providers; + /// List of OAuth2 providers. + final List providers; - OAuth2ProviderList({ - required this.total, - required this.providers, - }); + OAuth2ProviderList({ + required this.total, + required this.providers, + }); - factory OAuth2ProviderList.fromMap(Map map) { - return OAuth2ProviderList( - total: map['total'], - providers: List.from(map['providers'] ?? []), - ); - } + factory OAuth2ProviderList.fromMap(Map map) { + return OAuth2ProviderList( + total: map['total'], + providers: List.from(map['providers'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "providers": providers, - }; - } + @override + Map toMap() { + return { + "total": total, + "providers": providers, + }; + } } diff --git a/lib/src/models/o_auth2_salesforce.dart b/lib/src/models/o_auth2_salesforce.dart index ec235842..d796a1a8 100644 --- a/lib/src/models/o_auth2_salesforce.dart +++ b/lib/src/models/o_auth2_salesforce.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Salesforce class OAuth2Salesforce implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Salesforce OAuth2 consumer key. - final String customerKey; + /// Salesforce OAuth2 consumer key. + final String customerKey; - /// Salesforce OAuth2 consumer secret. - final String customerSecret; + /// Salesforce OAuth2 consumer secret. + final String customerSecret; - OAuth2Salesforce({ - required this.$id, - required this.enabled, - required this.customerKey, - required this.customerSecret, - }); + OAuth2Salesforce({ + required this.$id, + required this.enabled, + required this.customerKey, + required this.customerSecret, + }); - factory OAuth2Salesforce.fromMap(Map map) { - return OAuth2Salesforce( - $id: map['\$id'].toString(), - enabled: map['enabled'], - customerKey: map['customerKey'].toString(), - customerSecret: map['customerSecret'].toString(), - ); - } + factory OAuth2Salesforce.fromMap(Map map) { + return OAuth2Salesforce( + $id: map['\$id'].toString(), + enabled: map['enabled'], + customerKey: map['customerKey'].toString(), + customerSecret: map['customerSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "customerKey": customerKey, - "customerSecret": customerSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "customerKey": customerKey, + "customerSecret": customerSecret, + }; + } } diff --git a/lib/src/models/o_auth2_slack.dart b/lib/src/models/o_auth2_slack.dart index abace934..c91d1434 100644 --- a/lib/src/models/o_auth2_slack.dart +++ b/lib/src/models/o_auth2_slack.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Slack class OAuth2Slack implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Slack OAuth2 client ID. - final String clientId; + /// Slack OAuth2 client ID. + final String clientId; - /// Slack OAuth2 client secret. - final String clientSecret; + /// Slack OAuth2 client secret. + final String clientSecret; - OAuth2Slack({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Slack({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Slack.fromMap(Map map) { - return OAuth2Slack( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Slack.fromMap(Map map) { + return OAuth2Slack( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_spotify.dart b/lib/src/models/o_auth2_spotify.dart index b1e1e1cc..2486978d 100644 --- a/lib/src/models/o_auth2_spotify.dart +++ b/lib/src/models/o_auth2_spotify.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Spotify class OAuth2Spotify implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Spotify OAuth2 client ID. - final String clientId; + /// Spotify OAuth2 client ID. + final String clientId; - /// Spotify OAuth2 client secret. - final String clientSecret; + /// Spotify OAuth2 client secret. + final String clientSecret; - OAuth2Spotify({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Spotify({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Spotify.fromMap(Map map) { - return OAuth2Spotify( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Spotify.fromMap(Map map) { + return OAuth2Spotify( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_stripe.dart b/lib/src/models/o_auth2_stripe.dart index f348f287..c7cb6490 100644 --- a/lib/src/models/o_auth2_stripe.dart +++ b/lib/src/models/o_auth2_stripe.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Stripe class OAuth2Stripe implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Stripe OAuth2 client ID. - final String clientId; + /// Stripe OAuth2 client ID. + final String clientId; - /// Stripe OAuth2 API secret key. - final String apiSecretKey; + /// Stripe OAuth2 API secret key. + final String apiSecretKey; - OAuth2Stripe({ - required this.$id, - required this.enabled, - required this.clientId, - required this.apiSecretKey, - }); + OAuth2Stripe({ + required this.$id, + required this.enabled, + required this.clientId, + required this.apiSecretKey, + }); - factory OAuth2Stripe.fromMap(Map map) { - return OAuth2Stripe( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - apiSecretKey: map['apiSecretKey'].toString(), - ); - } + factory OAuth2Stripe.fromMap(Map map) { + return OAuth2Stripe( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + apiSecretKey: map['apiSecretKey'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "apiSecretKey": apiSecretKey, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "apiSecretKey": apiSecretKey, + }; + } } diff --git a/lib/src/models/o_auth2_tradeshift.dart b/lib/src/models/o_auth2_tradeshift.dart index 769619e2..8c95905f 100644 --- a/lib/src/models/o_auth2_tradeshift.dart +++ b/lib/src/models/o_auth2_tradeshift.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Tradeshift class OAuth2Tradeshift implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Tradeshift OAuth2 client ID. - final String oauth2ClientId; + /// Tradeshift OAuth2 client ID. + final String oauth2ClientId; - /// Tradeshift OAuth2 client secret. - final String oauth2ClientSecret; + /// Tradeshift OAuth2 client secret. + final String oauth2ClientSecret; - OAuth2Tradeshift({ - required this.$id, - required this.enabled, - required this.oauth2ClientId, - required this.oauth2ClientSecret, - }); + OAuth2Tradeshift({ + required this.$id, + required this.enabled, + required this.oauth2ClientId, + required this.oauth2ClientSecret, + }); - factory OAuth2Tradeshift.fromMap(Map map) { - return OAuth2Tradeshift( - $id: map['\$id'].toString(), - enabled: map['enabled'], - oauth2ClientId: map['oauth2ClientId'].toString(), - oauth2ClientSecret: map['oauth2ClientSecret'].toString(), - ); - } + factory OAuth2Tradeshift.fromMap(Map map) { + return OAuth2Tradeshift( + $id: map['\$id'].toString(), + enabled: map['enabled'], + oauth2ClientId: map['oauth2ClientId'].toString(), + oauth2ClientSecret: map['oauth2ClientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "oauth2ClientId": oauth2ClientId, - "oauth2ClientSecret": oauth2ClientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "oauth2ClientId": oauth2ClientId, + "oauth2ClientSecret": oauth2ClientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_twitch.dart b/lib/src/models/o_auth2_twitch.dart index 643bf8e4..79657192 100644 --- a/lib/src/models/o_auth2_twitch.dart +++ b/lib/src/models/o_auth2_twitch.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Twitch class OAuth2Twitch implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Twitch OAuth2 client ID. - final String clientId; + /// Twitch OAuth2 client ID. + final String clientId; - /// Twitch OAuth2 client secret. - final String clientSecret; + /// Twitch OAuth2 client secret. + final String clientSecret; - OAuth2Twitch({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Twitch({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Twitch.fromMap(Map map) { - return OAuth2Twitch( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Twitch.fromMap(Map map) { + return OAuth2Twitch( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_word_press.dart b/lib/src/models/o_auth2_word_press.dart index 6605b590..de659b78 100644 --- a/lib/src/models/o_auth2_word_press.dart +++ b/lib/src/models/o_auth2_word_press.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2WordPress class OAuth2WordPress implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// WordPress OAuth2 client ID. - final String clientId; + /// WordPress OAuth2 client ID. + final String clientId; - /// WordPress OAuth2 client secret. - final String clientSecret; + /// WordPress OAuth2 client secret. + final String clientSecret; - OAuth2WordPress({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2WordPress({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2WordPress.fromMap(Map map) { - return OAuth2WordPress( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2WordPress.fromMap(Map map) { + return OAuth2WordPress( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_x.dart b/lib/src/models/o_auth2_x.dart index 9c7773f0..fac9f15f 100644 --- a/lib/src/models/o_auth2_x.dart +++ b/lib/src/models/o_auth2_x.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2X class OAuth2X implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// X OAuth2 customer key. - final String customerKey; + /// X OAuth2 customer key. + final String customerKey; - /// X OAuth2 secret key. - final String secretKey; + /// X OAuth2 secret key. + final String secretKey; - OAuth2X({ - required this.$id, - required this.enabled, - required this.customerKey, - required this.secretKey, - }); + OAuth2X({ + required this.$id, + required this.enabled, + required this.customerKey, + required this.secretKey, + }); - factory OAuth2X.fromMap(Map map) { - return OAuth2X( - $id: map['\$id'].toString(), - enabled: map['enabled'], - customerKey: map['customerKey'].toString(), - secretKey: map['secretKey'].toString(), - ); - } + factory OAuth2X.fromMap(Map map) { + return OAuth2X( + $id: map['\$id'].toString(), + enabled: map['enabled'], + customerKey: map['customerKey'].toString(), + secretKey: map['secretKey'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "customerKey": customerKey, - "secretKey": secretKey, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "customerKey": customerKey, + "secretKey": secretKey, + }; + } } diff --git a/lib/src/models/o_auth2_yahoo.dart b/lib/src/models/o_auth2_yahoo.dart index 5579b44d..b7bc91a0 100644 --- a/lib/src/models/o_auth2_yahoo.dart +++ b/lib/src/models/o_auth2_yahoo.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Yahoo class OAuth2Yahoo implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Yahoo OAuth2 client ID. - final String clientId; + /// Yahoo OAuth2 client ID. + final String clientId; - /// Yahoo OAuth2 client secret. - final String clientSecret; + /// Yahoo OAuth2 client secret. + final String clientSecret; - OAuth2Yahoo({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Yahoo({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Yahoo.fromMap(Map map) { - return OAuth2Yahoo( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Yahoo.fromMap(Map map) { + return OAuth2Yahoo( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_yandex.dart b/lib/src/models/o_auth2_yandex.dart index 444bede9..7ef040d0 100644 --- a/lib/src/models/o_auth2_yandex.dart +++ b/lib/src/models/o_auth2_yandex.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Yandex class OAuth2Yandex implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Yandex OAuth2 client ID. - final String clientId; + /// Yandex OAuth2 client ID. + final String clientId; - /// Yandex OAuth2 client secret. - final String clientSecret; + /// Yandex OAuth2 client secret. + final String clientSecret; - OAuth2Yandex({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Yandex({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Yandex.fromMap(Map map) { - return OAuth2Yandex( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Yandex.fromMap(Map map) { + return OAuth2Yandex( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_zoho.dart b/lib/src/models/o_auth2_zoho.dart index 829bf8bf..ebe05c49 100644 --- a/lib/src/models/o_auth2_zoho.dart +++ b/lib/src/models/o_auth2_zoho.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Zoho class OAuth2Zoho implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Zoho OAuth2 client ID. - final String clientId; + /// Zoho OAuth2 client ID. + final String clientId; - /// Zoho OAuth2 client secret. - final String clientSecret; + /// Zoho OAuth2 client secret. + final String clientSecret; - OAuth2Zoho({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Zoho({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Zoho.fromMap(Map map) { - return OAuth2Zoho( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Zoho.fromMap(Map map) { + return OAuth2Zoho( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/o_auth2_zoom.dart b/lib/src/models/o_auth2_zoom.dart index 6f1f6126..84f3e654 100644 --- a/lib/src/models/o_auth2_zoom.dart +++ b/lib/src/models/o_auth2_zoom.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// OAuth2Zoom class OAuth2Zoom implements Model { - /// OAuth2 provider ID. - final String $id; + /// OAuth2 provider ID. + final String $id; - /// OAuth2 provider is active and can be used to create sessions. - final bool enabled; + /// OAuth2 provider is active and can be used to create sessions. + final bool enabled; - /// Zoom OAuth2 client ID. - final String clientId; + /// Zoom OAuth2 client ID. + final String clientId; - /// Zoom OAuth2 client secret. - final String clientSecret; + /// Zoom OAuth2 client secret. + final String clientSecret; - OAuth2Zoom({ - required this.$id, - required this.enabled, - required this.clientId, - required this.clientSecret, - }); + OAuth2Zoom({ + required this.$id, + required this.enabled, + required this.clientId, + required this.clientSecret, + }); - factory OAuth2Zoom.fromMap(Map map) { - return OAuth2Zoom( - $id: map['\$id'].toString(), - enabled: map['enabled'], - clientId: map['clientId'].toString(), - clientSecret: map['clientSecret'].toString(), - ); - } + factory OAuth2Zoom.fromMap(Map map) { + return OAuth2Zoom( + $id: map['\$id'].toString(), + enabled: map['enabled'], + clientId: map['clientId'].toString(), + clientSecret: map['clientSecret'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - "clientId": clientId, - "clientSecret": clientSecret, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + "clientId": clientId, + "clientSecret": clientSecret, + }; + } } diff --git a/lib/src/models/phone.dart b/lib/src/models/phone.dart index 7ac578e2..60e2abd9 100644 --- a/lib/src/models/phone.dart +++ b/lib/src/models/phone.dart @@ -2,35 +2,35 @@ part of '../../models.dart'; /// Phone class Phone implements Model { - /// Phone code. - final String code; + /// Phone code. + final String code; - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; - /// Country name. - final String countryName; + /// Country name. + final String countryName; - Phone({ - required this.code, - required this.countryCode, - required this.countryName, - }); + Phone({ + required this.code, + required this.countryCode, + required this.countryName, + }); - factory Phone.fromMap(Map map) { - return Phone( - code: map['code'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - ); - } + factory Phone.fromMap(Map map) { + return Phone( + code: map['code'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + ); + } - @override - Map toMap() { - return { - "code": code, - "countryCode": countryCode, - "countryName": countryName, - }; - } + @override + Map toMap() { + return { + "code": code, + "countryCode": countryCode, + "countryName": countryName, + }; + } } diff --git a/lib/src/models/phone_list.dart b/lib/src/models/phone_list.dart index 9791d590..1a197fc7 100644 --- a/lib/src/models/phone_list.dart +++ b/lib/src/models/phone_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Phones List class PhoneList implements Model { - /// Total number of phones that matched your query. - final int total; + /// Total number of phones that matched your query. + final int total; - /// List of phones. - final List phones; + /// List of phones. + final List phones; - PhoneList({ - required this.total, - required this.phones, - }); + PhoneList({ + required this.total, + required this.phones, + }); - factory PhoneList.fromMap(Map map) { - return PhoneList( - total: map['total'], - phones: List.from(map['phones'].map((p) => Phone.fromMap(p))), - ); - } + factory PhoneList.fromMap(Map map) { + return PhoneList( + total: map['total'], + phones: List.from(map['phones'].map((p) => Phone.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "phones": phones.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "phones": phones.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/platform_android.dart b/lib/src/models/platform_android.dart index 57421cbf..0f8d940d 100644 --- a/lib/src/models/platform_android.dart +++ b/lib/src/models/platform_android.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Android class PlatformAndroid implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Android application ID. - final String applicationId; - - PlatformAndroid({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.applicationId, - }); - - factory PlatformAndroid.fromMap(Map map) { - return PlatformAndroid( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - applicationId: map['applicationId'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "applicationId": applicationId, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Android application ID. + final String applicationId; + + PlatformAndroid({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.applicationId, + }); + + factory PlatformAndroid.fromMap(Map map) { + return PlatformAndroid( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + applicationId: map['applicationId'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "applicationId": applicationId, + }; + } } diff --git a/lib/src/models/platform_apple.dart b/lib/src/models/platform_apple.dart index 37aaa817..b421c15d 100644 --- a/lib/src/models/platform_apple.dart +++ b/lib/src/models/platform_apple.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Apple class PlatformApple implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Apple bundle identifier. - final String bundleIdentifier; - - PlatformApple({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.bundleIdentifier, - }); - - factory PlatformApple.fromMap(Map map) { - return PlatformApple( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - bundleIdentifier: map['bundleIdentifier'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "bundleIdentifier": bundleIdentifier, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Apple bundle identifier. + final String bundleIdentifier; + + PlatformApple({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.bundleIdentifier, + }); + + factory PlatformApple.fromMap(Map map) { + return PlatformApple( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + bundleIdentifier: map['bundleIdentifier'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "bundleIdentifier": bundleIdentifier, + }; + } } diff --git a/lib/src/models/platform_linux.dart b/lib/src/models/platform_linux.dart index e59803d2..45131dde 100644 --- a/lib/src/models/platform_linux.dart +++ b/lib/src/models/platform_linux.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Linux class PlatformLinux implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Linux package name. - final String packageName; - - PlatformLinux({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.packageName, - }); - - factory PlatformLinux.fromMap(Map map) { - return PlatformLinux( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - packageName: map['packageName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "packageName": packageName, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Linux package name. + final String packageName; + + PlatformLinux({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.packageName, + }); + + factory PlatformLinux.fromMap(Map map) { + return PlatformLinux( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + packageName: map['packageName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "packageName": packageName, + }; + } } diff --git a/lib/src/models/platform_list.dart b/lib/src/models/platform_list.dart index 9d099793..1c5f8b02 100644 --- a/lib/src/models/platform_list.dart +++ b/lib/src/models/platform_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Platforms List class PlatformList implements Model { - /// Total number of platforms in the given project. - final int total; + /// Total number of platforms in the given project. + final int total; - /// List of platforms. - final List platforms; + /// List of platforms. + final List platforms; - PlatformList({ - required this.total, - required this.platforms, - }); + PlatformList({ + required this.total, + required this.platforms, + }); - factory PlatformList.fromMap(Map map) { - return PlatformList( - total: map['total'], - platforms: List.from(map['platforms'] ?? []), - ); - } + factory PlatformList.fromMap(Map map) { + return PlatformList( + total: map['total'], + platforms: List.from(map['platforms'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "platforms": platforms, - }; - } + @override + Map toMap() { + return { + "total": total, + "platforms": platforms, + }; + } } diff --git a/lib/src/models/platform_web.dart b/lib/src/models/platform_web.dart index e4de0941..630225df 100644 --- a/lib/src/models/platform_web.dart +++ b/lib/src/models/platform_web.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Web class PlatformWeb implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Web app hostname. Empty string for other platforms. - final String hostname; - - PlatformWeb({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.hostname, - }); - - factory PlatformWeb.fromMap(Map map) { - return PlatformWeb( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - hostname: map['hostname'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "hostname": hostname, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Web app hostname. Empty string for other platforms. + final String hostname; + + PlatformWeb({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.hostname, + }); + + factory PlatformWeb.fromMap(Map map) { + return PlatformWeb( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + hostname: map['hostname'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "hostname": hostname, + }; + } } diff --git a/lib/src/models/platform_windows.dart b/lib/src/models/platform_windows.dart index 1e7c121a..957533a4 100644 --- a/lib/src/models/platform_windows.dart +++ b/lib/src/models/platform_windows.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Platform Windows class PlatformWindows implements Model { - /// Platform ID. - final String $id; - - /// Platform creation date in ISO 8601 format. - final String $createdAt; - - /// Platform update date in ISO 8601 format. - final String $updatedAt; - - /// Platform name. - final String name; - - /// Platform type. Possible values are: windows, apple, android, linux, web. - final enums.PlatformType type; - - /// Windows package identifier name. - final String packageIdentifierName; - - PlatformWindows({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.type, - required this.packageIdentifierName, - }); - - factory PlatformWindows.fromMap(Map map) { - return PlatformWindows( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), - packageIdentifierName: map['packageIdentifierName'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "type": type.value, - "packageIdentifierName": packageIdentifierName, - }; - } + /// Platform ID. + final String $id; + + /// Platform creation date in ISO 8601 format. + final String $createdAt; + + /// Platform update date in ISO 8601 format. + final String $updatedAt; + + /// Platform name. + final String name; + + /// Platform type. Possible values are: windows, apple, android, linux, web. + final enums.PlatformType type; + + /// Windows package identifier name. + final String packageIdentifierName; + + PlatformWindows({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.type, + required this.packageIdentifierName, + }); + + factory PlatformWindows.fromMap(Map map) { + return PlatformWindows( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + type: enums.PlatformType.values.firstWhere((e) => e.value == map['type']), + packageIdentifierName: map['packageIdentifierName'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "type": type.value, + "packageIdentifierName": packageIdentifierName, + }; + } } diff --git a/lib/src/models/policy_list.dart b/lib/src/models/policy_list.dart index 6443a439..a8f4bff7 100644 --- a/lib/src/models/policy_list.dart +++ b/lib/src/models/policy_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policies List class PolicyList implements Model { - /// Total number of policies in the given project. - final int total; + /// Total number of policies in the given project. + final int total; - /// List of policies. - final List policies; + /// List of policies. + final List policies; - PolicyList({ - required this.total, - required this.policies, - }); + PolicyList({ + required this.total, + required this.policies, + }); - factory PolicyList.fromMap(Map map) { - return PolicyList( - total: map['total'], - policies: List.from(map['policies'] ?? []), - ); - } + factory PolicyList.fromMap(Map map) { + return PolicyList( + total: map['total'], + policies: List.from(map['policies'] ?? []), + ); + } - @override - Map toMap() { - return { - "total": total, - "policies": policies, - }; - } + @override + Map toMap() { + return { + "total": total, + "policies": policies, + }; + } } diff --git a/lib/src/models/policy_membership_privacy.dart b/lib/src/models/policy_membership_privacy.dart index 8fadbbca..5cda0af3 100644 --- a/lib/src/models/policy_membership_privacy.dart +++ b/lib/src/models/policy_membership_privacy.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Policy Membership Privacy class PolicyMembershipPrivacy implements Model { - /// Policy ID. - final String $id; - - /// Whether user ID is visible in memberships. - final bool userId; - - /// Whether user email is visible in memberships. - final bool userEmail; - - /// Whether user phone is visible in memberships. - final bool userPhone; - - /// Whether user name is visible in memberships. - final bool userName; - - /// Whether user MFA status is visible in memberships. - final bool userMFA; - - PolicyMembershipPrivacy({ - required this.$id, - required this.userId, - required this.userEmail, - required this.userPhone, - required this.userName, - required this.userMFA, - }); - - factory PolicyMembershipPrivacy.fromMap(Map map) { - return PolicyMembershipPrivacy( - $id: map['\$id'].toString(), - userId: map['userId'], - userEmail: map['userEmail'], - userPhone: map['userPhone'], - userName: map['userName'], - userMFA: map['userMFA'], - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "userId": userId, - "userEmail": userEmail, - "userPhone": userPhone, - "userName": userName, - "userMFA": userMFA, - }; - } + /// Policy ID. + final String $id; + + /// Whether user ID is visible in memberships. + final bool userId; + + /// Whether user email is visible in memberships. + final bool userEmail; + + /// Whether user phone is visible in memberships. + final bool userPhone; + + /// Whether user name is visible in memberships. + final bool userName; + + /// Whether user MFA status is visible in memberships. + final bool userMFA; + + PolicyMembershipPrivacy({ + required this.$id, + required this.userId, + required this.userEmail, + required this.userPhone, + required this.userName, + required this.userMFA, + }); + + factory PolicyMembershipPrivacy.fromMap(Map map) { + return PolicyMembershipPrivacy( + $id: map['\$id'].toString(), + userId: map['userId'], + userEmail: map['userEmail'], + userPhone: map['userPhone'], + userName: map['userName'], + userMFA: map['userMFA'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "userId": userId, + "userEmail": userEmail, + "userPhone": userPhone, + "userName": userName, + "userMFA": userMFA, + }; + } } diff --git a/lib/src/models/policy_password_dictionary.dart b/lib/src/models/policy_password_dictionary.dart index 7ad863b3..1d58cf1e 100644 --- a/lib/src/models/policy_password_dictionary.dart +++ b/lib/src/models/policy_password_dictionary.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Password Dictionary class PolicyPasswordDictionary implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Whether password dictionary policy is enabled. - final bool enabled; + /// Whether password dictionary policy is enabled. + final bool enabled; - PolicyPasswordDictionary({ - required this.$id, - required this.enabled, - }); + PolicyPasswordDictionary({ + required this.$id, + required this.enabled, + }); - factory PolicyPasswordDictionary.fromMap(Map map) { - return PolicyPasswordDictionary( - $id: map['\$id'].toString(), - enabled: map['enabled'], - ); - } + factory PolicyPasswordDictionary.fromMap(Map map) { + return PolicyPasswordDictionary( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/policy_password_history.dart b/lib/src/models/policy_password_history.dart index fa9a350e..54caebd0 100644 --- a/lib/src/models/policy_password_history.dart +++ b/lib/src/models/policy_password_history.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Password History class PolicyPasswordHistory implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Password history length. A value of 0 means the policy is disabled. - final int total; + /// Password history length. A value of 0 means the policy is disabled. + final int total; - PolicyPasswordHistory({ - required this.$id, - required this.total, - }); + PolicyPasswordHistory({ + required this.$id, + required this.total, + }); - factory PolicyPasswordHistory.fromMap(Map map) { - return PolicyPasswordHistory( - $id: map['\$id'].toString(), - total: map['total'], - ); - } + factory PolicyPasswordHistory.fromMap(Map map) { + return PolicyPasswordHistory( + $id: map['\$id'].toString(), + total: map['total'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "total": total, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } } diff --git a/lib/src/models/policy_password_personal_data.dart b/lib/src/models/policy_password_personal_data.dart index 5fe4791d..223df126 100644 --- a/lib/src/models/policy_password_personal_data.dart +++ b/lib/src/models/policy_password_personal_data.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Password Personal Data class PolicyPasswordPersonalData implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Whether password personal data policy is enabled. - final bool enabled; + /// Whether password personal data policy is enabled. + final bool enabled; - PolicyPasswordPersonalData({ - required this.$id, - required this.enabled, - }); + PolicyPasswordPersonalData({ + required this.$id, + required this.enabled, + }); - factory PolicyPasswordPersonalData.fromMap(Map map) { - return PolicyPasswordPersonalData( - $id: map['\$id'].toString(), - enabled: map['enabled'], - ); - } + factory PolicyPasswordPersonalData.fromMap(Map map) { + return PolicyPasswordPersonalData( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/policy_session_alert.dart b/lib/src/models/policy_session_alert.dart index 9b5e4d03..05f9fe50 100644 --- a/lib/src/models/policy_session_alert.dart +++ b/lib/src/models/policy_session_alert.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Session Alert class PolicySessionAlert implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Whether session alert policy is enabled. - final bool enabled; + /// Whether session alert policy is enabled. + final bool enabled; - PolicySessionAlert({ - required this.$id, - required this.enabled, - }); + PolicySessionAlert({ + required this.$id, + required this.enabled, + }); - factory PolicySessionAlert.fromMap(Map map) { - return PolicySessionAlert( - $id: map['\$id'].toString(), - enabled: map['enabled'], - ); - } + factory PolicySessionAlert.fromMap(Map map) { + return PolicySessionAlert( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/policy_session_duration.dart b/lib/src/models/policy_session_duration.dart index 4cc81d0c..fc689d36 100644 --- a/lib/src/models/policy_session_duration.dart +++ b/lib/src/models/policy_session_duration.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Session Duration class PolicySessionDuration implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Session duration in seconds. - final int duration; + /// Session duration in seconds. + final int duration; - PolicySessionDuration({ - required this.$id, - required this.duration, - }); + PolicySessionDuration({ + required this.$id, + required this.duration, + }); - factory PolicySessionDuration.fromMap(Map map) { - return PolicySessionDuration( - $id: map['\$id'].toString(), - duration: map['duration'], - ); - } + factory PolicySessionDuration.fromMap(Map map) { + return PolicySessionDuration( + $id: map['\$id'].toString(), + duration: map['duration'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "duration": duration, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "duration": duration, + }; + } } diff --git a/lib/src/models/policy_session_invalidation.dart b/lib/src/models/policy_session_invalidation.dart index 4e33078d..bae38cf6 100644 --- a/lib/src/models/policy_session_invalidation.dart +++ b/lib/src/models/policy_session_invalidation.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Session Invalidation class PolicySessionInvalidation implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Whether session invalidation policy is enabled. - final bool enabled; + /// Whether session invalidation policy is enabled. + final bool enabled; - PolicySessionInvalidation({ - required this.$id, - required this.enabled, - }); + PolicySessionInvalidation({ + required this.$id, + required this.enabled, + }); - factory PolicySessionInvalidation.fromMap(Map map) { - return PolicySessionInvalidation( - $id: map['\$id'].toString(), - enabled: map['enabled'], - ); - } + factory PolicySessionInvalidation.fromMap(Map map) { + return PolicySessionInvalidation( + $id: map['\$id'].toString(), + enabled: map['enabled'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "enabled": enabled, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "enabled": enabled, + }; + } } diff --git a/lib/src/models/policy_session_limit.dart b/lib/src/models/policy_session_limit.dart index 419ac303..e74aa69d 100644 --- a/lib/src/models/policy_session_limit.dart +++ b/lib/src/models/policy_session_limit.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy Session Limit class PolicySessionLimit implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. - final int total; + /// Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. + final int total; - PolicySessionLimit({ - required this.$id, - required this.total, - }); + PolicySessionLimit({ + required this.$id, + required this.total, + }); - factory PolicySessionLimit.fromMap(Map map) { - return PolicySessionLimit( - $id: map['\$id'].toString(), - total: map['total'], - ); - } + factory PolicySessionLimit.fromMap(Map map) { + return PolicySessionLimit( + $id: map['\$id'].toString(), + total: map['total'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "total": total, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } } diff --git a/lib/src/models/policy_user_limit.dart b/lib/src/models/policy_user_limit.dart index 6436c4e2..1df4e85d 100644 --- a/lib/src/models/policy_user_limit.dart +++ b/lib/src/models/policy_user_limit.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Policy User Limit class PolicyUserLimit implements Model { - /// Policy ID. - final String $id; + /// Policy ID. + final String $id; - /// Maximum number of users allowed in the project. A value of 0 means the policy is disabled. - final int total; + /// Maximum number of users allowed in the project. A value of 0 means the policy is disabled. + final int total; - PolicyUserLimit({ - required this.$id, - required this.total, - }); + PolicyUserLimit({ + required this.$id, + required this.total, + }); - factory PolicyUserLimit.fromMap(Map map) { - return PolicyUserLimit( - $id: map['\$id'].toString(), - total: map['total'], - ); - } + factory PolicyUserLimit.fromMap(Map map) { + return PolicyUserLimit( + $id: map['\$id'].toString(), + total: map['total'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "total": total, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "total": total, + }; + } } diff --git a/lib/src/models/preferences.dart b/lib/src/models/preferences.dart index b107afe5..3ca04118 100644 --- a/lib/src/models/preferences.dart +++ b/lib/src/models/preferences.dart @@ -2,24 +2,24 @@ part of '../../models.dart'; /// Preferences class Preferences implements Model { - final Map data; + final Map data; - Preferences({ - required this.data, - }); + Preferences({ + required this.data, + }); - factory Preferences.fromMap(Map map) { - return Preferences( - data: map["data"] ?? map, - ); - } + factory Preferences.fromMap(Map map) { + return Preferences( + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "data": data, - }; - } + @override + Map toMap() { + return { + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/presence.dart b/lib/src/models/presence.dart index 19c5f285..5a722261 100644 --- a/lib/src/models/presence.dart +++ b/lib/src/models/presence.dart @@ -2,84 +2,84 @@ part of '../../models.dart'; /// Presence class Presence implements Model { - /// Presence ID. - final String $id; + /// Presence ID. + final String $id; - /// Presence sequence ID. - final String $sequence; + /// Presence sequence ID. + final String $sequence; - /// Presence creation date in ISO 8601 format. - final String $createdAt; + /// Presence creation date in ISO 8601 format. + final String $createdAt; - /// Presence update date in ISO 8601 format. - final String $updatedAt; + /// Presence update date in ISO 8601 format. + final String $updatedAt; - /// Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// User internal ID. - final String userInternalId; + /// User internal ID. + final String userInternalId; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Presence status. - final String? status; + /// Presence status. + final String? status; - /// Presence source. - final String source; + /// Presence source. + final String source; - /// Presence expiry date in ISO 8601 format. - final String? expiresAt; + /// Presence expiry date in ISO 8601 format. + final String? expiresAt; - final Map data; + final Map data; - Presence({ - required this.$id, - required this.$sequence, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.userInternalId, - required this.userId, - this.status, - required this.source, - this.expiresAt, - required this.data, - }); + Presence({ + required this.$id, + required this.$sequence, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.userInternalId, + required this.userId, + this.status, + required this.source, + this.expiresAt, + required this.data, + }); - factory Presence.fromMap(Map map) { - return Presence( - $id: map['\$id'].toString(), - $sequence: map['\$sequence'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - userInternalId: map['userInternalId'].toString(), - userId: map['userId'].toString(), - status: map['status']?.toString(), - source: map['source'].toString(), - expiresAt: map['expiresAt']?.toString(), - data: map["data"] ?? map, - ); - } + factory Presence.fromMap(Map map) { + return Presence( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + userInternalId: map['userInternalId'].toString(), + userId: map['userId'].toString(), + status: map['status']?.toString(), + source: map['source'].toString(), + expiresAt: map['expiresAt']?.toString(), + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "userInternalId": userInternalId, - "userId": userId, - "status": status, - "source": source, - "expiresAt": expiresAt, - "data": data, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "userInternalId": userInternalId, + "userId": userId, + "status": status, + "source": source, + "expiresAt": expiresAt, + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/presence_list.dart b/lib/src/models/presence_list.dart index 9c56ed41..ddd87e31 100644 --- a/lib/src/models/presence_list.dart +++ b/lib/src/models/presence_list.dart @@ -2,32 +2,33 @@ part of '../../models.dart'; /// Presences List class PresenceList implements Model { - /// Total number of presences that matched your query. - final int total; + /// Total number of presences that matched your query. + final int total; - /// List of presences. - final List presences; + /// List of presences. + final List presences; - PresenceList({ - required this.total, - required this.presences, - }); + PresenceList({ + required this.total, + required this.presences, + }); - factory PresenceList.fromMap(Map map) { - return PresenceList( - total: map['total'], - presences: List.from(map['presences'].map((p) => Presence.fromMap(p))), - ); - } + factory PresenceList.fromMap(Map map) { + return PresenceList( + total: map['total'], + presences: + List.from(map['presences'].map((p) => Presence.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "presences": presences.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "presences": presences.map((p) => p.toMap()).toList(), + }; + } - List convertTo(T Function(Map) fromJson) => - presences.map((d) => d.convertTo(fromJson)).toList(); + List convertTo(T Function(Map) fromJson) => + presences.map((d) => d.convertTo(fromJson)).toList(); } diff --git a/lib/src/models/project.dart b/lib/src/models/project.dart index 186f1c79..ccd476dc 100644 --- a/lib/src/models/project.dart +++ b/lib/src/models/project.dart @@ -2,503 +2,506 @@ part of '../../models.dart'; /// Project class Project implements Model { - /// Project ID. - final String $id; + /// Project ID. + final String $id; - /// Project creation date in ISO 8601 format. - final String $createdAt; + /// Project creation date in ISO 8601 format. + final String $createdAt; - /// Project update date in ISO 8601 format. - final String $updatedAt; + /// Project update date in ISO 8601 format. + final String $updatedAt; - /// Project name. - final String name; + /// Project name. + final String name; - /// Project description. - final String description; + /// Project description. + final String description; - /// Project team ID. - final String teamId; + /// Project team ID. + final String teamId; - /// Project logo file ID. - final String logo; + /// Project logo file ID. + final String logo; - /// Project website URL. - final String url; + /// Project website URL. + final String url; - /// Company legal name. - final String legalName; + /// Company legal name. + final String legalName; - /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. - final String legalCountry; + /// Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. + final String legalCountry; - /// State name. - final String legalState; + /// State name. + final String legalState; - /// City name. - final String legalCity; + /// City name. + final String legalCity; - /// Company Address. - final String legalAddress; + /// Company Address. + final String legalAddress; - /// Company Tax ID. - final String legalTaxId; + /// Company Tax ID. + final String legalTaxId; - /// Session duration in seconds. - final int authDuration; + /// Session duration in seconds. + final int authDuration; - /// Max users allowed. 0 is unlimited. - final int authLimit; + /// Max users allowed. 0 is unlimited. + final int authLimit; - /// Max sessions allowed per user. 100 maximum. - final int authSessionsLimit; + /// Max sessions allowed per user. 100 maximum. + final int authSessionsLimit; - /// Max allowed passwords in the history list per user. Max passwords limit allowed in history is 20. Use 0 for disabling password history. - final int authPasswordHistory; + /// Max allowed passwords in the history list per user. Max passwords limit allowed in history is 20. Use 0 for disabling password history. + final int authPasswordHistory; - /// Whether or not to check user's password against most commonly used passwords. - final bool authPasswordDictionary; + /// Whether or not to check user's password against most commonly used passwords. + final bool authPasswordDictionary; - /// Whether or not to check the user password for similarity with their personal data. - final bool authPersonalDataCheck; + /// Whether or not to check the user password for similarity with their personal data. + final bool authPersonalDataCheck; - /// Whether or not to disallow disposable email addresses during signup and email updates. - final bool authDisposableEmails; + /// Whether or not to disallow disposable email addresses during signup and email updates. + final bool authDisposableEmails; - /// Whether or not to require canonical email addresses during signup and email updates. - final bool authCanonicalEmails; + /// Whether or not to require canonical email addresses during signup and email updates. + final bool authCanonicalEmails; - /// Whether or not to disallow free email addresses during signup and email updates. - final bool authFreeEmails; + /// Whether or not to disallow free email addresses during signup and email updates. + final bool authFreeEmails; - /// An array of mock numbers and their corresponding verification codes (OTPs). - final List authMockNumbers; + /// An array of mock numbers and their corresponding verification codes (OTPs). + final List authMockNumbers; - /// Whether or not to send session alert emails to users. - final bool authSessionAlerts; + /// Whether or not to send session alert emails to users. + final bool authSessionAlerts; - /// Whether or not to show user names in the teams membership response. - final bool authMembershipsUserName; + /// Whether or not to show user names in the teams membership response. + final bool authMembershipsUserName; - /// Whether or not to show user emails in the teams membership response. - final bool authMembershipsUserEmail; + /// Whether or not to show user emails in the teams membership response. + final bool authMembershipsUserEmail; - /// Whether or not to show user MFA status in the teams membership response. - final bool authMembershipsMfa; + /// Whether or not to show user MFA status in the teams membership response. + final bool authMembershipsMfa; - /// Whether or not to show user IDs in the teams membership response. - final bool authMembershipsUserId; + /// Whether or not to show user IDs in the teams membership response. + final bool authMembershipsUserId; - /// Whether or not to show user phone numbers in the teams membership response. - final bool authMembershipsUserPhone; + /// Whether or not to show user phone numbers in the teams membership response. + final bool authMembershipsUserPhone; - /// Whether or not all existing sessions should be invalidated on password change - final bool authInvalidateSessions; + /// Whether or not all existing sessions should be invalidated on password change + final bool authInvalidateSessions; - /// List of Auth Providers. - final List oAuthProviders; + /// List of Auth Providers. + final List oAuthProviders; - /// List of Platforms. - final List platforms; + /// List of Platforms. + final List platforms; - /// List of Webhooks. - final List webhooks; + /// List of Webhooks. + final List webhooks; - /// List of API Keys. - final List keys; + /// List of API Keys. + final List keys; - /// List of dev keys. - final List devKeys; + /// List of dev keys. + final List devKeys; - /// Status for custom SMTP - final bool smtpEnabled; + /// Status for custom SMTP + final bool smtpEnabled; - /// SMTP sender name - final String smtpSenderName; + /// SMTP sender name + final String smtpSenderName; - /// SMTP sender email - final String smtpSenderEmail; + /// SMTP sender email + final String smtpSenderEmail; - /// SMTP reply to name - final String smtpReplyToName; + /// SMTP reply to name + final String smtpReplyToName; - /// SMTP reply to email - final String smtpReplyToEmail; + /// SMTP reply to email + final String smtpReplyToEmail; - /// SMTP server host name - final String smtpHost; + /// SMTP server host name + final String smtpHost; - /// SMTP server port - final int smtpPort; + /// SMTP server port + final int smtpPort; - /// SMTP server username - final String smtpUsername; + /// SMTP server username + final String smtpUsername; - /// SMTP server password. This property is write-only and always returned empty. - final String smtpPassword; + /// SMTP server password. This property is write-only and always returned empty. + final String smtpPassword; - /// SMTP server secure protocol - final String smtpSecure; + /// SMTP server secure protocol + final String smtpSecure; - /// Number of times the ping was received for this project. - final int pingCount; + /// Number of times the ping was received for this project. + final int pingCount; - /// Last ping datetime in ISO 8601 format. - final String pingedAt; + /// Last ping datetime in ISO 8601 format. + final String pingedAt; - /// Labels for the project. - final List labels; + /// Labels for the project. + final List labels; - /// Project status - final String status; + /// Project status + final String status; - /// Email/Password auth method status - final bool authEmailPassword; + /// Email/Password auth method status + final bool authEmailPassword; - /// Magic URL auth method status - final bool authUsersAuthMagicURL; + /// Magic URL auth method status + final bool authUsersAuthMagicURL; - /// Email (OTP) auth method status - final bool authEmailOtp; + /// Email (OTP) auth method status + final bool authEmailOtp; - /// Anonymous auth method status - final bool authAnonymous; + /// Anonymous auth method status + final bool authAnonymous; - /// Invites auth method status - final bool authInvites; + /// Invites auth method status + final bool authInvites; - /// JWT auth method status - final bool authJWT; + /// JWT auth method status + final bool authJWT; - /// Phone auth method status - final bool authPhone; + /// Phone auth method status + final bool authPhone; - /// Account service status - final bool serviceStatusForAccount; + /// Account service status + final bool serviceStatusForAccount; - /// Avatars service status - final bool serviceStatusForAvatars; + /// Avatars service status + final bool serviceStatusForAvatars; - /// Databases (legacy) service status - final bool serviceStatusForDatabases; + /// Databases (legacy) service status + final bool serviceStatusForDatabases; - /// TablesDB service status - final bool serviceStatusForTablesdb; + /// TablesDB service status + final bool serviceStatusForTablesdb; - /// Locale service status - final bool serviceStatusForLocale; + /// Locale service status + final bool serviceStatusForLocale; - /// Health service status - final bool serviceStatusForHealth; + /// Health service status + final bool serviceStatusForHealth; - /// Project service status - final bool serviceStatusForProject; + /// Project service status + final bool serviceStatusForProject; - /// Storage service status - final bool serviceStatusForStorage; + /// Storage service status + final bool serviceStatusForStorage; - /// Teams service status - final bool serviceStatusForTeams; - - /// Users service status - final bool serviceStatusForUsers; - - /// VCS service status - final bool serviceStatusForVcs; - - /// Sites service status - final bool serviceStatusForSites; - - /// Functions service status - final bool serviceStatusForFunctions; - - /// Proxy service status - final bool serviceStatusForProxy; - - /// GraphQL service status - final bool serviceStatusForGraphql; - - /// Migrations service status - final bool serviceStatusForMigrations; - - /// Messaging service status - final bool serviceStatusForMessaging; - - /// REST protocol status - final bool protocolStatusForRest; - - /// GraphQL protocol status - final bool protocolStatusForGraphql; - - /// Websocket protocol status - final bool protocolStatusForWebsocket; - - /// Project region - final String region; - - /// Billing limits reached - final BillingLimits billingLimits; - - /// Project blocks information - final List blocks; - - /// Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. - final String consoleAccessedAt; - - Project({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.description, - required this.teamId, - required this.logo, - required this.url, - required this.legalName, - required this.legalCountry, - required this.legalState, - required this.legalCity, - required this.legalAddress, - required this.legalTaxId, - required this.authDuration, - required this.authLimit, - required this.authSessionsLimit, - required this.authPasswordHistory, - required this.authPasswordDictionary, - required this.authPersonalDataCheck, - required this.authDisposableEmails, - required this.authCanonicalEmails, - required this.authFreeEmails, - required this.authMockNumbers, - required this.authSessionAlerts, - required this.authMembershipsUserName, - required this.authMembershipsUserEmail, - required this.authMembershipsMfa, - required this.authMembershipsUserId, - required this.authMembershipsUserPhone, - required this.authInvalidateSessions, - required this.oAuthProviders, - required this.platforms, - required this.webhooks, - required this.keys, - required this.devKeys, - required this.smtpEnabled, - required this.smtpSenderName, - required this.smtpSenderEmail, - required this.smtpReplyToName, - required this.smtpReplyToEmail, - required this.smtpHost, - required this.smtpPort, - required this.smtpUsername, - required this.smtpPassword, - required this.smtpSecure, - required this.pingCount, - required this.pingedAt, - required this.labels, - required this.status, - required this.authEmailPassword, - required this.authUsersAuthMagicURL, - required this.authEmailOtp, - required this.authAnonymous, - required this.authInvites, - required this.authJWT, - required this.authPhone, - required this.serviceStatusForAccount, - required this.serviceStatusForAvatars, - required this.serviceStatusForDatabases, - required this.serviceStatusForTablesdb, - required this.serviceStatusForLocale, - required this.serviceStatusForHealth, - required this.serviceStatusForProject, - required this.serviceStatusForStorage, - required this.serviceStatusForTeams, - required this.serviceStatusForUsers, - required this.serviceStatusForVcs, - required this.serviceStatusForSites, - required this.serviceStatusForFunctions, - required this.serviceStatusForProxy, - required this.serviceStatusForGraphql, - required this.serviceStatusForMigrations, - required this.serviceStatusForMessaging, - required this.protocolStatusForRest, - required this.protocolStatusForGraphql, - required this.protocolStatusForWebsocket, - required this.region, - required this.billingLimits, - required this.blocks, - required this.consoleAccessedAt, - }); - - factory Project.fromMap(Map map) { - return Project( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - description: map['description'].toString(), - teamId: map['teamId'].toString(), - logo: map['logo'].toString(), - url: map['url'].toString(), - legalName: map['legalName'].toString(), - legalCountry: map['legalCountry'].toString(), - legalState: map['legalState'].toString(), - legalCity: map['legalCity'].toString(), - legalAddress: map['legalAddress'].toString(), - legalTaxId: map['legalTaxId'].toString(), - authDuration: map['authDuration'], - authLimit: map['authLimit'], - authSessionsLimit: map['authSessionsLimit'], - authPasswordHistory: map['authPasswordHistory'], - authPasswordDictionary: map['authPasswordDictionary'], - authPersonalDataCheck: map['authPersonalDataCheck'], - authDisposableEmails: map['authDisposableEmails'], - authCanonicalEmails: map['authCanonicalEmails'], - authFreeEmails: map['authFreeEmails'], - authMockNumbers: List.from(map['authMockNumbers'].map((p) => MockNumber.fromMap(p))), - authSessionAlerts: map['authSessionAlerts'], - authMembershipsUserName: map['authMembershipsUserName'], - authMembershipsUserEmail: map['authMembershipsUserEmail'], - authMembershipsMfa: map['authMembershipsMfa'], - authMembershipsUserId: map['authMembershipsUserId'], - authMembershipsUserPhone: map['authMembershipsUserPhone'], - authInvalidateSessions: map['authInvalidateSessions'], - oAuthProviders: List.from(map['oAuthProviders'].map((p) => AuthProvider.fromMap(p))), - platforms: List.from(map['platforms'] ?? []), - webhooks: List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), - keys: List.from(map['keys'].map((p) => Key.fromMap(p))), - devKeys: List.from(map['devKeys'].map((p) => DevKey.fromMap(p))), - smtpEnabled: map['smtpEnabled'], - smtpSenderName: map['smtpSenderName'].toString(), - smtpSenderEmail: map['smtpSenderEmail'].toString(), - smtpReplyToName: map['smtpReplyToName'].toString(), - smtpReplyToEmail: map['smtpReplyToEmail'].toString(), - smtpHost: map['smtpHost'].toString(), - smtpPort: map['smtpPort'], - smtpUsername: map['smtpUsername'].toString(), - smtpPassword: map['smtpPassword'].toString(), - smtpSecure: map['smtpSecure'].toString(), - pingCount: map['pingCount'], - pingedAt: map['pingedAt'].toString(), - labels: List.from(map['labels'] ?? []), - status: map['status'].toString(), - authEmailPassword: map['authEmailPassword'], - authUsersAuthMagicURL: map['authUsersAuthMagicURL'], - authEmailOtp: map['authEmailOtp'], - authAnonymous: map['authAnonymous'], - authInvites: map['authInvites'], - authJWT: map['authJWT'], - authPhone: map['authPhone'], - serviceStatusForAccount: map['serviceStatusForAccount'], - serviceStatusForAvatars: map['serviceStatusForAvatars'], - serviceStatusForDatabases: map['serviceStatusForDatabases'], - serviceStatusForTablesdb: map['serviceStatusForTablesdb'], - serviceStatusForLocale: map['serviceStatusForLocale'], - serviceStatusForHealth: map['serviceStatusForHealth'], - serviceStatusForProject: map['serviceStatusForProject'], - serviceStatusForStorage: map['serviceStatusForStorage'], - serviceStatusForTeams: map['serviceStatusForTeams'], - serviceStatusForUsers: map['serviceStatusForUsers'], - serviceStatusForVcs: map['serviceStatusForVcs'], - serviceStatusForSites: map['serviceStatusForSites'], - serviceStatusForFunctions: map['serviceStatusForFunctions'], - serviceStatusForProxy: map['serviceStatusForProxy'], - serviceStatusForGraphql: map['serviceStatusForGraphql'], - serviceStatusForMigrations: map['serviceStatusForMigrations'], - serviceStatusForMessaging: map['serviceStatusForMessaging'], - protocolStatusForRest: map['protocolStatusForRest'], - protocolStatusForGraphql: map['protocolStatusForGraphql'], - protocolStatusForWebsocket: map['protocolStatusForWebsocket'], - region: map['region'].toString(), - billingLimits: BillingLimits.fromMap(map['billingLimits']), - blocks: List.from(map['blocks'].map((p) => Block.fromMap(p))), - consoleAccessedAt: map['consoleAccessedAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "description": description, - "teamId": teamId, - "logo": logo, - "url": url, - "legalName": legalName, - "legalCountry": legalCountry, - "legalState": legalState, - "legalCity": legalCity, - "legalAddress": legalAddress, - "legalTaxId": legalTaxId, - "authDuration": authDuration, - "authLimit": authLimit, - "authSessionsLimit": authSessionsLimit, - "authPasswordHistory": authPasswordHistory, - "authPasswordDictionary": authPasswordDictionary, - "authPersonalDataCheck": authPersonalDataCheck, - "authDisposableEmails": authDisposableEmails, - "authCanonicalEmails": authCanonicalEmails, - "authFreeEmails": authFreeEmails, - "authMockNumbers": authMockNumbers.map((p) => p.toMap()).toList(), - "authSessionAlerts": authSessionAlerts, - "authMembershipsUserName": authMembershipsUserName, - "authMembershipsUserEmail": authMembershipsUserEmail, - "authMembershipsMfa": authMembershipsMfa, - "authMembershipsUserId": authMembershipsUserId, - "authMembershipsUserPhone": authMembershipsUserPhone, - "authInvalidateSessions": authInvalidateSessions, - "oAuthProviders": oAuthProviders.map((p) => p.toMap()).toList(), - "platforms": platforms, - "webhooks": webhooks.map((p) => p.toMap()).toList(), - "keys": keys.map((p) => p.toMap()).toList(), - "devKeys": devKeys.map((p) => p.toMap()).toList(), - "smtpEnabled": smtpEnabled, - "smtpSenderName": smtpSenderName, - "smtpSenderEmail": smtpSenderEmail, - "smtpReplyToName": smtpReplyToName, - "smtpReplyToEmail": smtpReplyToEmail, - "smtpHost": smtpHost, - "smtpPort": smtpPort, - "smtpUsername": smtpUsername, - "smtpPassword": smtpPassword, - "smtpSecure": smtpSecure, - "pingCount": pingCount, - "pingedAt": pingedAt, - "labels": labels, - "status": status, - "authEmailPassword": authEmailPassword, - "authUsersAuthMagicURL": authUsersAuthMagicURL, - "authEmailOtp": authEmailOtp, - "authAnonymous": authAnonymous, - "authInvites": authInvites, - "authJWT": authJWT, - "authPhone": authPhone, - "serviceStatusForAccount": serviceStatusForAccount, - "serviceStatusForAvatars": serviceStatusForAvatars, - "serviceStatusForDatabases": serviceStatusForDatabases, - "serviceStatusForTablesdb": serviceStatusForTablesdb, - "serviceStatusForLocale": serviceStatusForLocale, - "serviceStatusForHealth": serviceStatusForHealth, - "serviceStatusForProject": serviceStatusForProject, - "serviceStatusForStorage": serviceStatusForStorage, - "serviceStatusForTeams": serviceStatusForTeams, - "serviceStatusForUsers": serviceStatusForUsers, - "serviceStatusForVcs": serviceStatusForVcs, - "serviceStatusForSites": serviceStatusForSites, - "serviceStatusForFunctions": serviceStatusForFunctions, - "serviceStatusForProxy": serviceStatusForProxy, - "serviceStatusForGraphql": serviceStatusForGraphql, - "serviceStatusForMigrations": serviceStatusForMigrations, - "serviceStatusForMessaging": serviceStatusForMessaging, - "protocolStatusForRest": protocolStatusForRest, - "protocolStatusForGraphql": protocolStatusForGraphql, - "protocolStatusForWebsocket": protocolStatusForWebsocket, - "region": region, - "billingLimits": billingLimits.toMap(), - "blocks": blocks.map((p) => p.toMap()).toList(), - "consoleAccessedAt": consoleAccessedAt, - }; - } + /// Teams service status + final bool serviceStatusForTeams; + + /// Users service status + final bool serviceStatusForUsers; + + /// VCS service status + final bool serviceStatusForVcs; + + /// Sites service status + final bool serviceStatusForSites; + + /// Functions service status + final bool serviceStatusForFunctions; + + /// Proxy service status + final bool serviceStatusForProxy; + + /// GraphQL service status + final bool serviceStatusForGraphql; + + /// Migrations service status + final bool serviceStatusForMigrations; + + /// Messaging service status + final bool serviceStatusForMessaging; + + /// REST protocol status + final bool protocolStatusForRest; + + /// GraphQL protocol status + final bool protocolStatusForGraphql; + + /// Websocket protocol status + final bool protocolStatusForWebsocket; + + /// Project region + final String region; + + /// Billing limits reached + final BillingLimits billingLimits; + + /// Project blocks information + final List blocks; + + /// Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + final String consoleAccessedAt; + + Project({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.description, + required this.teamId, + required this.logo, + required this.url, + required this.legalName, + required this.legalCountry, + required this.legalState, + required this.legalCity, + required this.legalAddress, + required this.legalTaxId, + required this.authDuration, + required this.authLimit, + required this.authSessionsLimit, + required this.authPasswordHistory, + required this.authPasswordDictionary, + required this.authPersonalDataCheck, + required this.authDisposableEmails, + required this.authCanonicalEmails, + required this.authFreeEmails, + required this.authMockNumbers, + required this.authSessionAlerts, + required this.authMembershipsUserName, + required this.authMembershipsUserEmail, + required this.authMembershipsMfa, + required this.authMembershipsUserId, + required this.authMembershipsUserPhone, + required this.authInvalidateSessions, + required this.oAuthProviders, + required this.platforms, + required this.webhooks, + required this.keys, + required this.devKeys, + required this.smtpEnabled, + required this.smtpSenderName, + required this.smtpSenderEmail, + required this.smtpReplyToName, + required this.smtpReplyToEmail, + required this.smtpHost, + required this.smtpPort, + required this.smtpUsername, + required this.smtpPassword, + required this.smtpSecure, + required this.pingCount, + required this.pingedAt, + required this.labels, + required this.status, + required this.authEmailPassword, + required this.authUsersAuthMagicURL, + required this.authEmailOtp, + required this.authAnonymous, + required this.authInvites, + required this.authJWT, + required this.authPhone, + required this.serviceStatusForAccount, + required this.serviceStatusForAvatars, + required this.serviceStatusForDatabases, + required this.serviceStatusForTablesdb, + required this.serviceStatusForLocale, + required this.serviceStatusForHealth, + required this.serviceStatusForProject, + required this.serviceStatusForStorage, + required this.serviceStatusForTeams, + required this.serviceStatusForUsers, + required this.serviceStatusForVcs, + required this.serviceStatusForSites, + required this.serviceStatusForFunctions, + required this.serviceStatusForProxy, + required this.serviceStatusForGraphql, + required this.serviceStatusForMigrations, + required this.serviceStatusForMessaging, + required this.protocolStatusForRest, + required this.protocolStatusForGraphql, + required this.protocolStatusForWebsocket, + required this.region, + required this.billingLimits, + required this.blocks, + required this.consoleAccessedAt, + }); + + factory Project.fromMap(Map map) { + return Project( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + description: map['description'].toString(), + teamId: map['teamId'].toString(), + logo: map['logo'].toString(), + url: map['url'].toString(), + legalName: map['legalName'].toString(), + legalCountry: map['legalCountry'].toString(), + legalState: map['legalState'].toString(), + legalCity: map['legalCity'].toString(), + legalAddress: map['legalAddress'].toString(), + legalTaxId: map['legalTaxId'].toString(), + authDuration: map['authDuration'], + authLimit: map['authLimit'], + authSessionsLimit: map['authSessionsLimit'], + authPasswordHistory: map['authPasswordHistory'], + authPasswordDictionary: map['authPasswordDictionary'], + authPersonalDataCheck: map['authPersonalDataCheck'], + authDisposableEmails: map['authDisposableEmails'], + authCanonicalEmails: map['authCanonicalEmails'], + authFreeEmails: map['authFreeEmails'], + authMockNumbers: List.from( + map['authMockNumbers'].map((p) => MockNumber.fromMap(p))), + authSessionAlerts: map['authSessionAlerts'], + authMembershipsUserName: map['authMembershipsUserName'], + authMembershipsUserEmail: map['authMembershipsUserEmail'], + authMembershipsMfa: map['authMembershipsMfa'], + authMembershipsUserId: map['authMembershipsUserId'], + authMembershipsUserPhone: map['authMembershipsUserPhone'], + authInvalidateSessions: map['authInvalidateSessions'], + oAuthProviders: List.from( + map['oAuthProviders'].map((p) => AuthProvider.fromMap(p))), + platforms: List.from(map['platforms'] ?? []), + webhooks: + List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), + keys: List.from(map['keys'].map((p) => Key.fromMap(p))), + devKeys: List.from(map['devKeys'].map((p) => DevKey.fromMap(p))), + smtpEnabled: map['smtpEnabled'], + smtpSenderName: map['smtpSenderName'].toString(), + smtpSenderEmail: map['smtpSenderEmail'].toString(), + smtpReplyToName: map['smtpReplyToName'].toString(), + smtpReplyToEmail: map['smtpReplyToEmail'].toString(), + smtpHost: map['smtpHost'].toString(), + smtpPort: map['smtpPort'], + smtpUsername: map['smtpUsername'].toString(), + smtpPassword: map['smtpPassword'].toString(), + smtpSecure: map['smtpSecure'].toString(), + pingCount: map['pingCount'], + pingedAt: map['pingedAt'].toString(), + labels: List.from(map['labels'] ?? []), + status: map['status'].toString(), + authEmailPassword: map['authEmailPassword'], + authUsersAuthMagicURL: map['authUsersAuthMagicURL'], + authEmailOtp: map['authEmailOtp'], + authAnonymous: map['authAnonymous'], + authInvites: map['authInvites'], + authJWT: map['authJWT'], + authPhone: map['authPhone'], + serviceStatusForAccount: map['serviceStatusForAccount'], + serviceStatusForAvatars: map['serviceStatusForAvatars'], + serviceStatusForDatabases: map['serviceStatusForDatabases'], + serviceStatusForTablesdb: map['serviceStatusForTablesdb'], + serviceStatusForLocale: map['serviceStatusForLocale'], + serviceStatusForHealth: map['serviceStatusForHealth'], + serviceStatusForProject: map['serviceStatusForProject'], + serviceStatusForStorage: map['serviceStatusForStorage'], + serviceStatusForTeams: map['serviceStatusForTeams'], + serviceStatusForUsers: map['serviceStatusForUsers'], + serviceStatusForVcs: map['serviceStatusForVcs'], + serviceStatusForSites: map['serviceStatusForSites'], + serviceStatusForFunctions: map['serviceStatusForFunctions'], + serviceStatusForProxy: map['serviceStatusForProxy'], + serviceStatusForGraphql: map['serviceStatusForGraphql'], + serviceStatusForMigrations: map['serviceStatusForMigrations'], + serviceStatusForMessaging: map['serviceStatusForMessaging'], + protocolStatusForRest: map['protocolStatusForRest'], + protocolStatusForGraphql: map['protocolStatusForGraphql'], + protocolStatusForWebsocket: map['protocolStatusForWebsocket'], + region: map['region'].toString(), + billingLimits: BillingLimits.fromMap(map['billingLimits']), + blocks: List.from(map['blocks'].map((p) => Block.fromMap(p))), + consoleAccessedAt: map['consoleAccessedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "description": description, + "teamId": teamId, + "logo": logo, + "url": url, + "legalName": legalName, + "legalCountry": legalCountry, + "legalState": legalState, + "legalCity": legalCity, + "legalAddress": legalAddress, + "legalTaxId": legalTaxId, + "authDuration": authDuration, + "authLimit": authLimit, + "authSessionsLimit": authSessionsLimit, + "authPasswordHistory": authPasswordHistory, + "authPasswordDictionary": authPasswordDictionary, + "authPersonalDataCheck": authPersonalDataCheck, + "authDisposableEmails": authDisposableEmails, + "authCanonicalEmails": authCanonicalEmails, + "authFreeEmails": authFreeEmails, + "authMockNumbers": authMockNumbers.map((p) => p.toMap()).toList(), + "authSessionAlerts": authSessionAlerts, + "authMembershipsUserName": authMembershipsUserName, + "authMembershipsUserEmail": authMembershipsUserEmail, + "authMembershipsMfa": authMembershipsMfa, + "authMembershipsUserId": authMembershipsUserId, + "authMembershipsUserPhone": authMembershipsUserPhone, + "authInvalidateSessions": authInvalidateSessions, + "oAuthProviders": oAuthProviders.map((p) => p.toMap()).toList(), + "platforms": platforms, + "webhooks": webhooks.map((p) => p.toMap()).toList(), + "keys": keys.map((p) => p.toMap()).toList(), + "devKeys": devKeys.map((p) => p.toMap()).toList(), + "smtpEnabled": smtpEnabled, + "smtpSenderName": smtpSenderName, + "smtpSenderEmail": smtpSenderEmail, + "smtpReplyToName": smtpReplyToName, + "smtpReplyToEmail": smtpReplyToEmail, + "smtpHost": smtpHost, + "smtpPort": smtpPort, + "smtpUsername": smtpUsername, + "smtpPassword": smtpPassword, + "smtpSecure": smtpSecure, + "pingCount": pingCount, + "pingedAt": pingedAt, + "labels": labels, + "status": status, + "authEmailPassword": authEmailPassword, + "authUsersAuthMagicURL": authUsersAuthMagicURL, + "authEmailOtp": authEmailOtp, + "authAnonymous": authAnonymous, + "authInvites": authInvites, + "authJWT": authJWT, + "authPhone": authPhone, + "serviceStatusForAccount": serviceStatusForAccount, + "serviceStatusForAvatars": serviceStatusForAvatars, + "serviceStatusForDatabases": serviceStatusForDatabases, + "serviceStatusForTablesdb": serviceStatusForTablesdb, + "serviceStatusForLocale": serviceStatusForLocale, + "serviceStatusForHealth": serviceStatusForHealth, + "serviceStatusForProject": serviceStatusForProject, + "serviceStatusForStorage": serviceStatusForStorage, + "serviceStatusForTeams": serviceStatusForTeams, + "serviceStatusForUsers": serviceStatusForUsers, + "serviceStatusForVcs": serviceStatusForVcs, + "serviceStatusForSites": serviceStatusForSites, + "serviceStatusForFunctions": serviceStatusForFunctions, + "serviceStatusForProxy": serviceStatusForProxy, + "serviceStatusForGraphql": serviceStatusForGraphql, + "serviceStatusForMigrations": serviceStatusForMigrations, + "serviceStatusForMessaging": serviceStatusForMessaging, + "protocolStatusForRest": protocolStatusForRest, + "protocolStatusForGraphql": protocolStatusForGraphql, + "protocolStatusForWebsocket": protocolStatusForWebsocket, + "region": region, + "billingLimits": billingLimits.toMap(), + "blocks": blocks.map((p) => p.toMap()).toList(), + "consoleAccessedAt": consoleAccessedAt, + }; + } } diff --git a/lib/src/models/provider.dart b/lib/src/models/provider.dart index 016643ca..98b63a42 100644 --- a/lib/src/models/provider.dart +++ b/lib/src/models/provider.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Provider class Provider implements Model { - /// Provider ID. - final String $id; + /// Provider ID. + final String $id; - /// Provider creation time in ISO 8601 format. - final String $createdAt; + /// Provider creation time in ISO 8601 format. + final String $createdAt; - /// Provider update date in ISO 8601 format. - final String $updatedAt; + /// Provider update date in ISO 8601 format. + final String $updatedAt; - /// The name for the provider instance. - final String name; + /// The name for the provider instance. + final String name; - /// The name of the provider service. - final String provider; + /// The name of the provider service. + final String provider; - /// Is provider enabled? - final bool enabled; + /// Is provider enabled? + final bool enabled; - /// Type of provider. - final String type; + /// Type of provider. + final String type; - /// Provider credentials. - final Map credentials; + /// Provider credentials. + final Map credentials; - /// Provider options. - final Map? options; + /// Provider options. + final Map? options; - Provider({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.provider, - required this.enabled, - required this.type, - required this.credentials, - this.options, - }); + Provider({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.provider, + required this.enabled, + required this.type, + required this.credentials, + this.options, + }); - factory Provider.fromMap(Map map) { - return Provider( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - provider: map['provider'].toString(), - enabled: map['enabled'], - type: map['type'].toString(), - credentials: map['credentials'], - options: map['options'], - ); - } + factory Provider.fromMap(Map map) { + return Provider( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + provider: map['provider'].toString(), + enabled: map['enabled'], + type: map['type'].toString(), + credentials: map['credentials'], + options: map['options'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "provider": provider, - "enabled": enabled, - "type": type, - "credentials": credentials, - "options": options, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "provider": provider, + "enabled": enabled, + "type": type, + "credentials": credentials, + "options": options, + }; + } } diff --git a/lib/src/models/provider_list.dart b/lib/src/models/provider_list.dart index f184ef8c..78085644 100644 --- a/lib/src/models/provider_list.dart +++ b/lib/src/models/provider_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Provider list class ProviderList implements Model { - /// Total number of providers that matched your query. - final int total; + /// Total number of providers that matched your query. + final int total; - /// List of providers. - final List providers; + /// List of providers. + final List providers; - ProviderList({ - required this.total, - required this.providers, - }); + ProviderList({ + required this.total, + required this.providers, + }); - factory ProviderList.fromMap(Map map) { - return ProviderList( - total: map['total'], - providers: List.from(map['providers'].map((p) => Provider.fromMap(p))), - ); - } + factory ProviderList.fromMap(Map map) { + return ProviderList( + total: map['total'], + providers: + List.from(map['providers'].map((p) => Provider.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "providers": providers.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "providers": providers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/proxy_rule.dart b/lib/src/models/proxy_rule.dart index b6bb800e..9e1945dc 100644 --- a/lib/src/models/proxy_rule.dart +++ b/lib/src/models/proxy_rule.dart @@ -2,107 +2,112 @@ part of '../../models.dart'; /// Rule class ProxyRule implements Model { - /// Rule ID. - final String $id; - - /// Rule creation date in ISO 8601 format. - final String $createdAt; - - /// Rule update date in ISO 8601 format. - final String $updatedAt; - - /// Domain name. - final String domain; - - /// Action definition for the rule. Possible values are "api", "deployment", or "redirect" - final String type; - - /// Defines how the rule was created. Possible values are "manual" or "deployment" - final String trigger; - - /// URL to redirect to. Used if type is "redirect" - final String redirectUrl; - - /// Status code to apply during redirect. Used if type is "redirect" - final int redirectStatusCode; - - /// ID of deployment. Used if type is "deployment" - final String deploymentId; - - /// Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". - final enums.ProxyRuleDeploymentResourceType? deploymentResourceType; - - /// ID of deployment's resource (site or function ID). Used if type is "deployment" - final String deploymentResourceId; - - /// Name of Git branch that updates rule. Used if type is "deployment" - final String deploymentVcsProviderBranch; - - /// Domain verification status. Possible values are "unverified", "verifying", "verified" - final enums.ProxyRuleStatus status; - - /// Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. - final String logs; - - /// Certificate auto-renewal date in ISO 8601 format. - final String renewAt; - - ProxyRule({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.domain, - required this.type, - required this.trigger, - required this.redirectUrl, - required this.redirectStatusCode, - required this.deploymentId, - this.deploymentResourceType, - required this.deploymentResourceId, - required this.deploymentVcsProviderBranch, - required this.status, - required this.logs, - required this.renewAt, - }); - - factory ProxyRule.fromMap(Map map) { - return ProxyRule( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - domain: map['domain'].toString(), - type: map['type'].toString(), - trigger: map['trigger'].toString(), - redirectUrl: map['redirectUrl'].toString(), - redirectStatusCode: map['redirectStatusCode'], - deploymentId: map['deploymentId'].toString(), - deploymentResourceType: map['deploymentResourceType'] != null ? enums.ProxyRuleDeploymentResourceType.values.firstWhere((e) => e.value == map['deploymentResourceType']) : null, - deploymentResourceId: map['deploymentResourceId'].toString(), - deploymentVcsProviderBranch: map['deploymentVcsProviderBranch'].toString(), - status: enums.ProxyRuleStatus.values.firstWhere((e) => e.value == map['status']), - logs: map['logs'].toString(), - renewAt: map['renewAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "domain": domain, - "type": type, - "trigger": trigger, - "redirectUrl": redirectUrl, - "redirectStatusCode": redirectStatusCode, - "deploymentId": deploymentId, - "deploymentResourceType": deploymentResourceType?.value, - "deploymentResourceId": deploymentResourceId, - "deploymentVcsProviderBranch": deploymentVcsProviderBranch, - "status": status.value, - "logs": logs, - "renewAt": renewAt, - }; - } + /// Rule ID. + final String $id; + + /// Rule creation date in ISO 8601 format. + final String $createdAt; + + /// Rule update date in ISO 8601 format. + final String $updatedAt; + + /// Domain name. + final String domain; + + /// Action definition for the rule. Possible values are "api", "deployment", or "redirect" + final String type; + + /// Defines how the rule was created. Possible values are "manual" or "deployment" + final String trigger; + + /// URL to redirect to. Used if type is "redirect" + final String redirectUrl; + + /// Status code to apply during redirect. Used if type is "redirect" + final int redirectStatusCode; + + /// ID of deployment. Used if type is "deployment" + final String deploymentId; + + /// Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + final enums.ProxyRuleDeploymentResourceType? deploymentResourceType; + + /// ID of deployment's resource (site or function ID). Used if type is "deployment" + final String deploymentResourceId; + + /// Name of Git branch that updates rule. Used if type is "deployment" + final String deploymentVcsProviderBranch; + + /// Domain verification status. Possible values are "unverified", "verifying", "verified" + final enums.ProxyRuleStatus status; + + /// Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. + final String logs; + + /// Certificate auto-renewal date in ISO 8601 format. + final String renewAt; + + ProxyRule({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.domain, + required this.type, + required this.trigger, + required this.redirectUrl, + required this.redirectStatusCode, + required this.deploymentId, + this.deploymentResourceType, + required this.deploymentResourceId, + required this.deploymentVcsProviderBranch, + required this.status, + required this.logs, + required this.renewAt, + }); + + factory ProxyRule.fromMap(Map map) { + return ProxyRule( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + domain: map['domain'].toString(), + type: map['type'].toString(), + trigger: map['trigger'].toString(), + redirectUrl: map['redirectUrl'].toString(), + redirectStatusCode: map['redirectStatusCode'], + deploymentId: map['deploymentId'].toString(), + deploymentResourceType: map['deploymentResourceType'] != null + ? enums.ProxyRuleDeploymentResourceType.values + .firstWhere((e) => e.value == map['deploymentResourceType']) + : null, + deploymentResourceId: map['deploymentResourceId'].toString(), + deploymentVcsProviderBranch: + map['deploymentVcsProviderBranch'].toString(), + status: enums.ProxyRuleStatus.values + .firstWhere((e) => e.value == map['status']), + logs: map['logs'].toString(), + renewAt: map['renewAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "domain": domain, + "type": type, + "trigger": trigger, + "redirectUrl": redirectUrl, + "redirectStatusCode": redirectStatusCode, + "deploymentId": deploymentId, + "deploymentResourceType": deploymentResourceType?.value, + "deploymentResourceId": deploymentResourceId, + "deploymentVcsProviderBranch": deploymentVcsProviderBranch, + "status": status.value, + "logs": logs, + "renewAt": renewAt, + }; + } } diff --git a/lib/src/models/proxy_rule_list.dart b/lib/src/models/proxy_rule_list.dart index 2e047986..1ae8951e 100644 --- a/lib/src/models/proxy_rule_list.dart +++ b/lib/src/models/proxy_rule_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Rule List class ProxyRuleList implements Model { - /// Total number of rules that matched your query. - final int total; + /// Total number of rules that matched your query. + final int total; - /// List of rules. - final List rules; + /// List of rules. + final List rules; - ProxyRuleList({ - required this.total, - required this.rules, - }); + ProxyRuleList({ + required this.total, + required this.rules, + }); - factory ProxyRuleList.fromMap(Map map) { - return ProxyRuleList( - total: map['total'], - rules: List.from(map['rules'].map((p) => ProxyRule.fromMap(p))), - ); - } + factory ProxyRuleList.fromMap(Map map) { + return ProxyRuleList( + total: map['total'], + rules: + List.from(map['rules'].map((p) => ProxyRule.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "rules": rules.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "rules": rules.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/resource_token.dart b/lib/src/models/resource_token.dart index 75d0e707..341dca63 100644 --- a/lib/src/models/resource_token.dart +++ b/lib/src/models/resource_token.dart @@ -2,59 +2,59 @@ part of '../../models.dart'; /// ResourceToken class ResourceToken implements Model { - /// Token ID. - final String $id; - - /// Token creation date in ISO 8601 format. - final String $createdAt; - - /// Resource ID. - final String resourceId; - - /// Resource type. - final String resourceType; - - /// Token expiration date in ISO 8601 format. - final String expire; - - /// JWT encoded string. - final String secret; - - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; - - ResourceToken({ - required this.$id, - required this.$createdAt, - required this.resourceId, - required this.resourceType, - required this.expire, - required this.secret, - required this.accessedAt, - }); - - factory ResourceToken.fromMap(Map map) { - return ResourceToken( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - resourceId: map['resourceId'].toString(), - resourceType: map['resourceType'].toString(), - expire: map['expire'].toString(), - secret: map['secret'].toString(), - accessedAt: map['accessedAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "resourceId": resourceId, - "resourceType": resourceType, - "expire": expire, - "secret": secret, - "accessedAt": accessedAt, - }; - } + /// Token ID. + final String $id; + + /// Token creation date in ISO 8601 format. + final String $createdAt; + + /// Resource ID. + final String resourceId; + + /// Resource type. + final String resourceType; + + /// Token expiration date in ISO 8601 format. + final String expire; + + /// JWT encoded string. + final String secret; + + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; + + ResourceToken({ + required this.$id, + required this.$createdAt, + required this.resourceId, + required this.resourceType, + required this.expire, + required this.secret, + required this.accessedAt, + }); + + factory ResourceToken.fromMap(Map map) { + return ResourceToken( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + resourceId: map['resourceId'].toString(), + resourceType: map['resourceType'].toString(), + expire: map['expire'].toString(), + secret: map['secret'].toString(), + accessedAt: map['accessedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "resourceId": resourceId, + "resourceType": resourceType, + "expire": expire, + "secret": secret, + "accessedAt": accessedAt, + }; + } } diff --git a/lib/src/models/resource_token_list.dart b/lib/src/models/resource_token_list.dart index 52136854..aa9918d2 100644 --- a/lib/src/models/resource_token_list.dart +++ b/lib/src/models/resource_token_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Resource Tokens List class ResourceTokenList implements Model { - /// Total number of tokens that matched your query. - final int total; + /// Total number of tokens that matched your query. + final int total; - /// List of tokens. - final List tokens; + /// List of tokens. + final List tokens; - ResourceTokenList({ - required this.total, - required this.tokens, - }); + ResourceTokenList({ + required this.total, + required this.tokens, + }); - factory ResourceTokenList.fromMap(Map map) { - return ResourceTokenList( - total: map['total'], - tokens: List.from(map['tokens'].map((p) => ResourceToken.fromMap(p))), - ); - } + factory ResourceTokenList.fromMap(Map map) { + return ResourceTokenList( + total: map['total'], + tokens: List.from( + map['tokens'].map((p) => ResourceToken.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "tokens": tokens.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "tokens": tokens.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/row.dart b/lib/src/models/row.dart index c5f233b4..a825eab0 100644 --- a/lib/src/models/row.dart +++ b/lib/src/models/row.dart @@ -2,66 +2,66 @@ part of '../../models.dart'; /// Row class Row implements Model { - /// Row ID. - final String $id; + /// Row ID. + final String $id; - /// Row sequence ID. - final String $sequence; + /// Row sequence ID. + final String $sequence; - /// Table ID. - final String $tableId; + /// Table ID. + final String $tableId; - /// Database ID. - final String $databaseId; + /// Database ID. + final String $databaseId; - /// Row creation date in ISO 8601 format. - final String $createdAt; + /// Row creation date in ISO 8601 format. + final String $createdAt; - /// Row update date in ISO 8601 format. - final String $updatedAt; + /// Row update date in ISO 8601 format. + final String $updatedAt; - /// Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - final Map data; + final Map data; - Row({ - required this.$id, - required this.$sequence, - required this.$tableId, - required this.$databaseId, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.data, - }); + Row({ + required this.$id, + required this.$sequence, + required this.$tableId, + required this.$databaseId, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.data, + }); - factory Row.fromMap(Map map) { - return Row( - $id: map['\$id'].toString(), - $sequence: map['\$sequence'].toString(), - $tableId: map['\$tableId'].toString(), - $databaseId: map['\$databaseId'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - data: map["data"] ?? map, - ); - } + factory Row.fromMap(Map map) { + return Row( + $id: map['\$id'].toString(), + $sequence: map['\$sequence'].toString(), + $tableId: map['\$tableId'].toString(), + $databaseId: map['\$databaseId'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + data: map["data"] ?? map, + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$sequence": $sequence, - "\$tableId": $tableId, - "\$databaseId": $databaseId, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "data": data, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$sequence": $sequence, + "\$tableId": $tableId, + "\$databaseId": $databaseId, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "data": data, + }; + } - T convertTo(T Function(Map) fromJson) => fromJson(data); + T convertTo(T Function(Map) fromJson) => fromJson(data); } diff --git a/lib/src/models/row_list.dart b/lib/src/models/row_list.dart index 90efa95f..5023c633 100644 --- a/lib/src/models/row_list.dart +++ b/lib/src/models/row_list.dart @@ -2,32 +2,32 @@ part of '../../models.dart'; /// Rows List class RowList implements Model { - /// Total number of rows that matched your query. - final int total; + /// Total number of rows that matched your query. + final int total; - /// List of rows. - final List rows; + /// List of rows. + final List rows; - RowList({ - required this.total, - required this.rows, - }); + RowList({ + required this.total, + required this.rows, + }); - factory RowList.fromMap(Map map) { - return RowList( - total: map['total'], - rows: List.from(map['rows'].map((p) => Row.fromMap(p))), - ); - } + factory RowList.fromMap(Map map) { + return RowList( + total: map['total'], + rows: List.from(map['rows'].map((p) => Row.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "rows": rows.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "rows": rows.map((p) => p.toMap()).toList(), + }; + } - List convertTo(T Function(Map) fromJson) => - rows.map((d) => d.convertTo(fromJson)).toList(); + List convertTo(T Function(Map) fromJson) => + rows.map((d) => d.convertTo(fromJson)).toList(); } diff --git a/lib/src/models/runtime.dart b/lib/src/models/runtime.dart index 92f1a93b..b989950c 100644 --- a/lib/src/models/runtime.dart +++ b/lib/src/models/runtime.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Runtime class Runtime implements Model { - /// Runtime ID. - final String $id; + /// Runtime ID. + final String $id; - /// Parent runtime key. - final String key; + /// Parent runtime key. + final String key; - /// Runtime Name. - final String name; + /// Runtime Name. + final String name; - /// Runtime version. - final String version; + /// Runtime version. + final String version; - /// Base Docker image used to build the runtime. - final String base; + /// Base Docker image used to build the runtime. + final String base; - /// Image name of Docker Hub. - final String image; + /// Image name of Docker Hub. + final String image; - /// Name of the logo image. - final String logo; + /// Name of the logo image. + final String logo; - /// List of supported architectures. - final List supports; + /// List of supported architectures. + final List supports; - Runtime({ - required this.$id, - required this.key, - required this.name, - required this.version, - required this.base, - required this.image, - required this.logo, - required this.supports, - }); + Runtime({ + required this.$id, + required this.key, + required this.name, + required this.version, + required this.base, + required this.image, + required this.logo, + required this.supports, + }); - factory Runtime.fromMap(Map map) { - return Runtime( - $id: map['\$id'].toString(), - key: map['key'].toString(), - name: map['name'].toString(), - version: map['version'].toString(), - base: map['base'].toString(), - image: map['image'].toString(), - logo: map['logo'].toString(), - supports: List.from(map['supports'] ?? []), - ); - } + factory Runtime.fromMap(Map map) { + return Runtime( + $id: map['\$id'].toString(), + key: map['key'].toString(), + name: map['name'].toString(), + version: map['version'].toString(), + base: map['base'].toString(), + image: map['image'].toString(), + logo: map['logo'].toString(), + supports: List.from(map['supports'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "key": key, - "name": name, - "version": version, - "base": base, - "image": image, - "logo": logo, - "supports": supports, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "key": key, + "name": name, + "version": version, + "base": base, + "image": image, + "logo": logo, + "supports": supports, + }; + } } diff --git a/lib/src/models/runtime_list.dart b/lib/src/models/runtime_list.dart index c9d0c3cb..f4169a55 100644 --- a/lib/src/models/runtime_list.dart +++ b/lib/src/models/runtime_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Runtimes List class RuntimeList implements Model { - /// Total number of runtimes that matched your query. - final int total; + /// Total number of runtimes that matched your query. + final int total; - /// List of runtimes. - final List runtimes; + /// List of runtimes. + final List runtimes; - RuntimeList({ - required this.total, - required this.runtimes, - }); + RuntimeList({ + required this.total, + required this.runtimes, + }); - factory RuntimeList.fromMap(Map map) { - return RuntimeList( - total: map['total'], - runtimes: List.from(map['runtimes'].map((p) => Runtime.fromMap(p))), - ); - } + factory RuntimeList.fromMap(Map map) { + return RuntimeList( + total: map['total'], + runtimes: + List.from(map['runtimes'].map((p) => Runtime.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "runtimes": runtimes.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "runtimes": runtimes.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/session.dart b/lib/src/models/session.dart index c37de95a..92e4034e 100644 --- a/lib/src/models/session.dart +++ b/lib/src/models/session.dart @@ -2,191 +2,191 @@ part of '../../models.dart'; /// Session class Session implements Model { - /// Session ID. - final String $id; + /// Session ID. + final String $id; - /// Session creation date in ISO 8601 format. - final String $createdAt; + /// Session creation date in ISO 8601 format. + final String $createdAt; - /// Session update date in ISO 8601 format. - final String $updatedAt; + /// Session update date in ISO 8601 format. + final String $updatedAt; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Session expiration date in ISO 8601 format. - final String expire; + /// Session expiration date in ISO 8601 format. + final String expire; - /// Session Provider. - final String provider; + /// Session Provider. + final String provider; - /// Session Provider User ID. - final String providerUid; + /// Session Provider User ID. + final String providerUid; - /// Session Provider Access Token. - final String providerAccessToken; - - /// The date of when the access token expires in ISO 8601 format. - final String providerAccessTokenExpiry; - - /// Session Provider Refresh Token. - final String providerRefreshToken; - - /// IP in use when the session was created. - final String ip; - - /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - final String osCode; - - /// Operating system name. - final String osName; - - /// Operating system version. - final String osVersion; - - /// Client type. - final String clientType; - - /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - final String clientCode; - - /// Client name. - final String clientName; - - /// Client version. - final String clientVersion; - - /// Client engine name. - final String clientEngine; - - /// Client engine name. - final String clientEngineVersion; - - /// Device name. - final String deviceName; - - /// Device brand name. - final String deviceBrand; - - /// Device model name. - final String deviceModel; - - /// Country two-character ISO 3166-1 alpha code. - final String countryCode; - - /// Country name. - final String countryName; - - /// Returns true if this the current user session. - final bool current; - - /// Returns a list of active session factors. - final List factors; - - /// Secret used to authenticate the user. Only included if the request was made with an API key - final String secret; - - /// Most recent date in ISO 8601 format when the session successfully passed MFA challenge. - final String mfaUpdatedAt; - - Session({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.userId, - required this.expire, - required this.provider, - required this.providerUid, - required this.providerAccessToken, - required this.providerAccessTokenExpiry, - required this.providerRefreshToken, - required this.ip, - required this.osCode, - required this.osName, - required this.osVersion, - required this.clientType, - required this.clientCode, - required this.clientName, - required this.clientVersion, - required this.clientEngine, - required this.clientEngineVersion, - required this.deviceName, - required this.deviceBrand, - required this.deviceModel, - required this.countryCode, - required this.countryName, - required this.current, - required this.factors, - required this.secret, - required this.mfaUpdatedAt, - }); - - factory Session.fromMap(Map map) { - return Session( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - userId: map['userId'].toString(), - expire: map['expire'].toString(), - provider: map['provider'].toString(), - providerUid: map['providerUid'].toString(), - providerAccessToken: map['providerAccessToken'].toString(), - providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), - providerRefreshToken: map['providerRefreshToken'].toString(), - ip: map['ip'].toString(), - osCode: map['osCode'].toString(), - osName: map['osName'].toString(), - osVersion: map['osVersion'].toString(), - clientType: map['clientType'].toString(), - clientCode: map['clientCode'].toString(), - clientName: map['clientName'].toString(), - clientVersion: map['clientVersion'].toString(), - clientEngine: map['clientEngine'].toString(), - clientEngineVersion: map['clientEngineVersion'].toString(), - deviceName: map['deviceName'].toString(), - deviceBrand: map['deviceBrand'].toString(), - deviceModel: map['deviceModel'].toString(), - countryCode: map['countryCode'].toString(), - countryName: map['countryName'].toString(), - current: map['current'], - factors: List.from(map['factors'] ?? []), - secret: map['secret'].toString(), - mfaUpdatedAt: map['mfaUpdatedAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "userId": userId, - "expire": expire, - "provider": provider, - "providerUid": providerUid, - "providerAccessToken": providerAccessToken, - "providerAccessTokenExpiry": providerAccessTokenExpiry, - "providerRefreshToken": providerRefreshToken, - "ip": ip, - "osCode": osCode, - "osName": osName, - "osVersion": osVersion, - "clientType": clientType, - "clientCode": clientCode, - "clientName": clientName, - "clientVersion": clientVersion, - "clientEngine": clientEngine, - "clientEngineVersion": clientEngineVersion, - "deviceName": deviceName, - "deviceBrand": deviceBrand, - "deviceModel": deviceModel, - "countryCode": countryCode, - "countryName": countryName, - "current": current, - "factors": factors, - "secret": secret, - "mfaUpdatedAt": mfaUpdatedAt, - }; - } + /// Session Provider Access Token. + final String providerAccessToken; + + /// The date of when the access token expires in ISO 8601 format. + final String providerAccessTokenExpiry; + + /// Session Provider Refresh Token. + final String providerRefreshToken; + + /// IP in use when the session was created. + final String ip; + + /// Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + final String osCode; + + /// Operating system name. + final String osName; + + /// Operating system version. + final String osVersion; + + /// Client type. + final String clientType; + + /// Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + final String clientCode; + + /// Client name. + final String clientName; + + /// Client version. + final String clientVersion; + + /// Client engine name. + final String clientEngine; + + /// Client engine name. + final String clientEngineVersion; + + /// Device name. + final String deviceName; + + /// Device brand name. + final String deviceBrand; + + /// Device model name. + final String deviceModel; + + /// Country two-character ISO 3166-1 alpha code. + final String countryCode; + + /// Country name. + final String countryName; + + /// Returns true if this the current user session. + final bool current; + + /// Returns a list of active session factors. + final List factors; + + /// Secret used to authenticate the user. Only included if the request was made with an API key + final String secret; + + /// Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + final String mfaUpdatedAt; + + Session({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.userId, + required this.expire, + required this.provider, + required this.providerUid, + required this.providerAccessToken, + required this.providerAccessTokenExpiry, + required this.providerRefreshToken, + required this.ip, + required this.osCode, + required this.osName, + required this.osVersion, + required this.clientType, + required this.clientCode, + required this.clientName, + required this.clientVersion, + required this.clientEngine, + required this.clientEngineVersion, + required this.deviceName, + required this.deviceBrand, + required this.deviceModel, + required this.countryCode, + required this.countryName, + required this.current, + required this.factors, + required this.secret, + required this.mfaUpdatedAt, + }); + + factory Session.fromMap(Map map) { + return Session( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + userId: map['userId'].toString(), + expire: map['expire'].toString(), + provider: map['provider'].toString(), + providerUid: map['providerUid'].toString(), + providerAccessToken: map['providerAccessToken'].toString(), + providerAccessTokenExpiry: map['providerAccessTokenExpiry'].toString(), + providerRefreshToken: map['providerRefreshToken'].toString(), + ip: map['ip'].toString(), + osCode: map['osCode'].toString(), + osName: map['osName'].toString(), + osVersion: map['osVersion'].toString(), + clientType: map['clientType'].toString(), + clientCode: map['clientCode'].toString(), + clientName: map['clientName'].toString(), + clientVersion: map['clientVersion'].toString(), + clientEngine: map['clientEngine'].toString(), + clientEngineVersion: map['clientEngineVersion'].toString(), + deviceName: map['deviceName'].toString(), + deviceBrand: map['deviceBrand'].toString(), + deviceModel: map['deviceModel'].toString(), + countryCode: map['countryCode'].toString(), + countryName: map['countryName'].toString(), + current: map['current'], + factors: List.from(map['factors'] ?? []), + secret: map['secret'].toString(), + mfaUpdatedAt: map['mfaUpdatedAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "userId": userId, + "expire": expire, + "provider": provider, + "providerUid": providerUid, + "providerAccessToken": providerAccessToken, + "providerAccessTokenExpiry": providerAccessTokenExpiry, + "providerRefreshToken": providerRefreshToken, + "ip": ip, + "osCode": osCode, + "osName": osName, + "osVersion": osVersion, + "clientType": clientType, + "clientCode": clientCode, + "clientName": clientName, + "clientVersion": clientVersion, + "clientEngine": clientEngine, + "clientEngineVersion": clientEngineVersion, + "deviceName": deviceName, + "deviceBrand": deviceBrand, + "deviceModel": deviceModel, + "countryCode": countryCode, + "countryName": countryName, + "current": current, + "factors": factors, + "secret": secret, + "mfaUpdatedAt": mfaUpdatedAt, + }; + } } diff --git a/lib/src/models/session_list.dart b/lib/src/models/session_list.dart index d823d0e6..4ea12394 100644 --- a/lib/src/models/session_list.dart +++ b/lib/src/models/session_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Sessions List class SessionList implements Model { - /// Total number of sessions that matched your query. - final int total; + /// Total number of sessions that matched your query. + final int total; - /// List of sessions. - final List sessions; + /// List of sessions. + final List sessions; - SessionList({ - required this.total, - required this.sessions, - }); + SessionList({ + required this.total, + required this.sessions, + }); - factory SessionList.fromMap(Map map) { - return SessionList( - total: map['total'], - sessions: List.from(map['sessions'].map((p) => Session.fromMap(p))), - ); - } + factory SessionList.fromMap(Map map) { + return SessionList( + total: map['total'], + sessions: + List.from(map['sessions'].map((p) => Session.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "sessions": sessions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "sessions": sessions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/site.dart b/lib/src/models/site.dart index 3bb19891..d2594ea7 100644 --- a/lib/src/models/site.dart +++ b/lib/src/models/site.dart @@ -2,209 +2,209 @@ part of '../../models.dart'; /// Site class Site implements Model { - /// Site ID. - final String $id; + /// Site ID. + final String $id; - /// Site creation date in ISO 8601 format. - final String $createdAt; + /// Site creation date in ISO 8601 format. + final String $createdAt; - /// Site update date in ISO 8601 format. - final String $updatedAt; + /// Site update date in ISO 8601 format. + final String $updatedAt; - /// Site name. - final String name; + /// Site name. + final String name; - /// Site enabled. - final bool enabled; + /// Site enabled. + final bool enabled; - /// Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. - final bool live; + /// Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. + final bool live; - /// When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - final bool logging; + /// When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + final bool logging; - /// Site framework. - final String framework; + /// Site framework. + final String framework; - /// How many days to keep the non-active deployments before they will be automatically deleted. - final int deploymentRetention; + /// How many days to keep the non-active deployments before they will be automatically deleted. + final int deploymentRetention; - /// Site's active deployment ID. - final String deploymentId; + /// Site's active deployment ID. + final String deploymentId; - /// Active deployment creation date in ISO 8601 format. - final String deploymentCreatedAt; + /// Active deployment creation date in ISO 8601 format. + final String deploymentCreatedAt; - /// Screenshot of active deployment with light theme preference file ID. - final String deploymentScreenshotLight; - - /// Screenshot of active deployment with dark theme preference file ID. - final String deploymentScreenshotDark; - - /// Site's latest deployment ID. - final String latestDeploymentId; - - /// Latest deployment creation date in ISO 8601 format. - final String latestDeploymentCreatedAt; - - /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - final String latestDeploymentStatus; - - /// Site variables. - final List vars; - - /// Site request timeout in seconds. - final int timeout; - - /// The install command used to install the site dependencies. - final String installCommand; - - /// The build command used to build the site. - final String buildCommand; - - /// Custom command to use when starting site runtime. - final String startCommand; - - /// The directory where the site build output is located. - final String outputDirectory; - - /// Site VCS (Version Control System) installation id. - final String installationId; - - /// VCS (Version Control System) Repository ID - final String providerRepositoryId; - - /// VCS (Version Control System) branch name - final String providerBranch; - - /// Path to site in VCS (Version Control System) repository - final String providerRootDirectory; - - /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - final bool providerSilentMode; - - /// Machine specification for deployment builds. - final String buildSpecification; - - /// Machine specification for SSR executions. - final String runtimeSpecification; - - /// Site build runtime. - final String buildRuntime; - - /// Site framework adapter. - final String adapter; - - /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - final String fallbackFile; - - Site({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.enabled, - required this.live, - required this.logging, - required this.framework, - required this.deploymentRetention, - required this.deploymentId, - required this.deploymentCreatedAt, - required this.deploymentScreenshotLight, - required this.deploymentScreenshotDark, - required this.latestDeploymentId, - required this.latestDeploymentCreatedAt, - required this.latestDeploymentStatus, - required this.vars, - required this.timeout, - required this.installCommand, - required this.buildCommand, - required this.startCommand, - required this.outputDirectory, - required this.installationId, - required this.providerRepositoryId, - required this.providerBranch, - required this.providerRootDirectory, - required this.providerSilentMode, - required this.buildSpecification, - required this.runtimeSpecification, - required this.buildRuntime, - required this.adapter, - required this.fallbackFile, - }); - - factory Site.fromMap(Map map) { - return Site( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - enabled: map['enabled'], - live: map['live'], - logging: map['logging'], - framework: map['framework'].toString(), - deploymentRetention: map['deploymentRetention'], - deploymentId: map['deploymentId'].toString(), - deploymentCreatedAt: map['deploymentCreatedAt'].toString(), - deploymentScreenshotLight: map['deploymentScreenshotLight'].toString(), - deploymentScreenshotDark: map['deploymentScreenshotDark'].toString(), - latestDeploymentId: map['latestDeploymentId'].toString(), - latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), - latestDeploymentStatus: map['latestDeploymentStatus'].toString(), - vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), - timeout: map['timeout'], - installCommand: map['installCommand'].toString(), - buildCommand: map['buildCommand'].toString(), - startCommand: map['startCommand'].toString(), - outputDirectory: map['outputDirectory'].toString(), - installationId: map['installationId'].toString(), - providerRepositoryId: map['providerRepositoryId'].toString(), - providerBranch: map['providerBranch'].toString(), - providerRootDirectory: map['providerRootDirectory'].toString(), - providerSilentMode: map['providerSilentMode'], - buildSpecification: map['buildSpecification'].toString(), - runtimeSpecification: map['runtimeSpecification'].toString(), - buildRuntime: map['buildRuntime'].toString(), - adapter: map['adapter'].toString(), - fallbackFile: map['fallbackFile'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "enabled": enabled, - "live": live, - "logging": logging, - "framework": framework, - "deploymentRetention": deploymentRetention, - "deploymentId": deploymentId, - "deploymentCreatedAt": deploymentCreatedAt, - "deploymentScreenshotLight": deploymentScreenshotLight, - "deploymentScreenshotDark": deploymentScreenshotDark, - "latestDeploymentId": latestDeploymentId, - "latestDeploymentCreatedAt": latestDeploymentCreatedAt, - "latestDeploymentStatus": latestDeploymentStatus, - "vars": vars.map((p) => p.toMap()).toList(), - "timeout": timeout, - "installCommand": installCommand, - "buildCommand": buildCommand, - "startCommand": startCommand, - "outputDirectory": outputDirectory, - "installationId": installationId, - "providerRepositoryId": providerRepositoryId, - "providerBranch": providerBranch, - "providerRootDirectory": providerRootDirectory, - "providerSilentMode": providerSilentMode, - "buildSpecification": buildSpecification, - "runtimeSpecification": runtimeSpecification, - "buildRuntime": buildRuntime, - "adapter": adapter, - "fallbackFile": fallbackFile, - }; - } + /// Screenshot of active deployment with light theme preference file ID. + final String deploymentScreenshotLight; + + /// Screenshot of active deployment with dark theme preference file ID. + final String deploymentScreenshotDark; + + /// Site's latest deployment ID. + final String latestDeploymentId; + + /// Latest deployment creation date in ISO 8601 format. + final String latestDeploymentCreatedAt; + + /// Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + final String latestDeploymentStatus; + + /// Site variables. + final List vars; + + /// Site request timeout in seconds. + final int timeout; + + /// The install command used to install the site dependencies. + final String installCommand; + + /// The build command used to build the site. + final String buildCommand; + + /// Custom command to use when starting site runtime. + final String startCommand; + + /// The directory where the site build output is located. + final String outputDirectory; + + /// Site VCS (Version Control System) installation id. + final String installationId; + + /// VCS (Version Control System) Repository ID + final String providerRepositoryId; + + /// VCS (Version Control System) branch name + final String providerBranch; + + /// Path to site in VCS (Version Control System) repository + final String providerRootDirectory; + + /// Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + final bool providerSilentMode; + + /// Machine specification for deployment builds. + final String buildSpecification; + + /// Machine specification for SSR executions. + final String runtimeSpecification; + + /// Site build runtime. + final String buildRuntime; + + /// Site framework adapter. + final String adapter; + + /// Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + final String fallbackFile; + + Site({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.enabled, + required this.live, + required this.logging, + required this.framework, + required this.deploymentRetention, + required this.deploymentId, + required this.deploymentCreatedAt, + required this.deploymentScreenshotLight, + required this.deploymentScreenshotDark, + required this.latestDeploymentId, + required this.latestDeploymentCreatedAt, + required this.latestDeploymentStatus, + required this.vars, + required this.timeout, + required this.installCommand, + required this.buildCommand, + required this.startCommand, + required this.outputDirectory, + required this.installationId, + required this.providerRepositoryId, + required this.providerBranch, + required this.providerRootDirectory, + required this.providerSilentMode, + required this.buildSpecification, + required this.runtimeSpecification, + required this.buildRuntime, + required this.adapter, + required this.fallbackFile, + }); + + factory Site.fromMap(Map map) { + return Site( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + enabled: map['enabled'], + live: map['live'], + logging: map['logging'], + framework: map['framework'].toString(), + deploymentRetention: map['deploymentRetention'], + deploymentId: map['deploymentId'].toString(), + deploymentCreatedAt: map['deploymentCreatedAt'].toString(), + deploymentScreenshotLight: map['deploymentScreenshotLight'].toString(), + deploymentScreenshotDark: map['deploymentScreenshotDark'].toString(), + latestDeploymentId: map['latestDeploymentId'].toString(), + latestDeploymentCreatedAt: map['latestDeploymentCreatedAt'].toString(), + latestDeploymentStatus: map['latestDeploymentStatus'].toString(), + vars: List.from(map['vars'].map((p) => Variable.fromMap(p))), + timeout: map['timeout'], + installCommand: map['installCommand'].toString(), + buildCommand: map['buildCommand'].toString(), + startCommand: map['startCommand'].toString(), + outputDirectory: map['outputDirectory'].toString(), + installationId: map['installationId'].toString(), + providerRepositoryId: map['providerRepositoryId'].toString(), + providerBranch: map['providerBranch'].toString(), + providerRootDirectory: map['providerRootDirectory'].toString(), + providerSilentMode: map['providerSilentMode'], + buildSpecification: map['buildSpecification'].toString(), + runtimeSpecification: map['runtimeSpecification'].toString(), + buildRuntime: map['buildRuntime'].toString(), + adapter: map['adapter'].toString(), + fallbackFile: map['fallbackFile'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "enabled": enabled, + "live": live, + "logging": logging, + "framework": framework, + "deploymentRetention": deploymentRetention, + "deploymentId": deploymentId, + "deploymentCreatedAt": deploymentCreatedAt, + "deploymentScreenshotLight": deploymentScreenshotLight, + "deploymentScreenshotDark": deploymentScreenshotDark, + "latestDeploymentId": latestDeploymentId, + "latestDeploymentCreatedAt": latestDeploymentCreatedAt, + "latestDeploymentStatus": latestDeploymentStatus, + "vars": vars.map((p) => p.toMap()).toList(), + "timeout": timeout, + "installCommand": installCommand, + "buildCommand": buildCommand, + "startCommand": startCommand, + "outputDirectory": outputDirectory, + "installationId": installationId, + "providerRepositoryId": providerRepositoryId, + "providerBranch": providerBranch, + "providerRootDirectory": providerRootDirectory, + "providerSilentMode": providerSilentMode, + "buildSpecification": buildSpecification, + "runtimeSpecification": runtimeSpecification, + "buildRuntime": buildRuntime, + "adapter": adapter, + "fallbackFile": fallbackFile, + }; + } } diff --git a/lib/src/models/site_list.dart b/lib/src/models/site_list.dart index ab1a72c5..27bff61f 100644 --- a/lib/src/models/site_list.dart +++ b/lib/src/models/site_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Sites List class SiteList implements Model { - /// Total number of sites that matched your query. - final int total; + /// Total number of sites that matched your query. + final int total; - /// List of sites. - final List sites; + /// List of sites. + final List sites; - SiteList({ - required this.total, - required this.sites, - }); + SiteList({ + required this.total, + required this.sites, + }); - factory SiteList.fromMap(Map map) { - return SiteList( - total: map['total'], - sites: List.from(map['sites'].map((p) => Site.fromMap(p))), - ); - } + factory SiteList.fromMap(Map map) { + return SiteList( + total: map['total'], + sites: List.from(map['sites'].map((p) => Site.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "sites": sites.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "sites": sites.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/specification.dart b/lib/src/models/specification.dart index 6ef82642..b1820b26 100644 --- a/lib/src/models/specification.dart +++ b/lib/src/models/specification.dart @@ -2,41 +2,41 @@ part of '../../models.dart'; /// Specification class Specification implements Model { - /// Memory size in MB. - final int memory; + /// Memory size in MB. + final int memory; - /// Number of CPUs. - final double cpus; + /// Number of CPUs. + final double cpus; - /// Is size enabled. - final bool enabled; + /// Is size enabled. + final bool enabled; - /// Size slug. - final String slug; + /// Size slug. + final String slug; - Specification({ - required this.memory, - required this.cpus, - required this.enabled, - required this.slug, - }); + Specification({ + required this.memory, + required this.cpus, + required this.enabled, + required this.slug, + }); - factory Specification.fromMap(Map map) { - return Specification( - memory: map['memory'], - cpus: map['cpus'].toDouble(), - enabled: map['enabled'], - slug: map['slug'].toString(), - ); - } + factory Specification.fromMap(Map map) { + return Specification( + memory: map['memory'], + cpus: map['cpus'].toDouble(), + enabled: map['enabled'], + slug: map['slug'].toString(), + ); + } - @override - Map toMap() { - return { - "memory": memory, - "cpus": cpus, - "enabled": enabled, - "slug": slug, - }; - } + @override + Map toMap() { + return { + "memory": memory, + "cpus": cpus, + "enabled": enabled, + "slug": slug, + }; + } } diff --git a/lib/src/models/specification_list.dart b/lib/src/models/specification_list.dart index ac645338..245e08c6 100644 --- a/lib/src/models/specification_list.dart +++ b/lib/src/models/specification_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Specifications List class SpecificationList implements Model { - /// Total number of specifications that matched your query. - final int total; + /// Total number of specifications that matched your query. + final int total; - /// List of specifications. - final List specifications; + /// List of specifications. + final List specifications; - SpecificationList({ - required this.total, - required this.specifications, - }); + SpecificationList({ + required this.total, + required this.specifications, + }); - factory SpecificationList.fromMap(Map map) { - return SpecificationList( - total: map['total'], - specifications: List.from(map['specifications'].map((p) => Specification.fromMap(p))), - ); - } + factory SpecificationList.fromMap(Map map) { + return SpecificationList( + total: map['total'], + specifications: List.from( + map['specifications'].map((p) => Specification.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "specifications": specifications.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "specifications": specifications.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/subscriber.dart b/lib/src/models/subscriber.dart index 850ab8d2..450aafd1 100644 --- a/lib/src/models/subscriber.dart +++ b/lib/src/models/subscriber.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Subscriber class Subscriber implements Model { - /// Subscriber ID. - final String $id; + /// Subscriber ID. + final String $id; - /// Subscriber creation time in ISO 8601 format. - final String $createdAt; + /// Subscriber creation time in ISO 8601 format. + final String $createdAt; - /// Subscriber update date in ISO 8601 format. - final String $updatedAt; + /// Subscriber update date in ISO 8601 format. + final String $updatedAt; - /// Target ID. - final String targetId; + /// Target ID. + final String targetId; - /// Target. - final Target target; + /// Target. + final Target target; - /// Topic ID. - final String userId; + /// Topic ID. + final String userId; - /// User Name. - final String userName; + /// User Name. + final String userName; - /// Topic ID. - final String topicId; + /// Topic ID. + final String topicId; - /// The target provider type. Can be one of the following: `email`, `sms` or `push`. - final String providerType; + /// The target provider type. Can be one of the following: `email`, `sms` or `push`. + final String providerType; - Subscriber({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.targetId, - required this.target, - required this.userId, - required this.userName, - required this.topicId, - required this.providerType, - }); + Subscriber({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.targetId, + required this.target, + required this.userId, + required this.userName, + required this.topicId, + required this.providerType, + }); - factory Subscriber.fromMap(Map map) { - return Subscriber( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - targetId: map['targetId'].toString(), - target: Target.fromMap(map['target']), - userId: map['userId'].toString(), - userName: map['userName'].toString(), - topicId: map['topicId'].toString(), - providerType: map['providerType'].toString(), - ); - } + factory Subscriber.fromMap(Map map) { + return Subscriber( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + targetId: map['targetId'].toString(), + target: Target.fromMap(map['target']), + userId: map['userId'].toString(), + userName: map['userName'].toString(), + topicId: map['topicId'].toString(), + providerType: map['providerType'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "targetId": targetId, - "target": target.toMap(), - "userId": userId, - "userName": userName, - "topicId": topicId, - "providerType": providerType, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "targetId": targetId, + "target": target.toMap(), + "userId": userId, + "userName": userName, + "topicId": topicId, + "providerType": providerType, + }; + } } diff --git a/lib/src/models/subscriber_list.dart b/lib/src/models/subscriber_list.dart index 3eb2e4fc..14fbf27e 100644 --- a/lib/src/models/subscriber_list.dart +++ b/lib/src/models/subscriber_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Subscriber list class SubscriberList implements Model { - /// Total number of subscribers that matched your query. - final int total; + /// Total number of subscribers that matched your query. + final int total; - /// List of subscribers. - final List subscribers; + /// List of subscribers. + final List subscribers; - SubscriberList({ - required this.total, - required this.subscribers, - }); + SubscriberList({ + required this.total, + required this.subscribers, + }); - factory SubscriberList.fromMap(Map map) { - return SubscriberList( - total: map['total'], - subscribers: List.from(map['subscribers'].map((p) => Subscriber.fromMap(p))), - ); - } + factory SubscriberList.fromMap(Map map) { + return SubscriberList( + total: map['total'], + subscribers: List.from( + map['subscribers'].map((p) => Subscriber.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "subscribers": subscribers.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "subscribers": subscribers.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/table.dart b/lib/src/models/table.dart index ddb15ade..9d0cc834 100644 --- a/lib/src/models/table.dart +++ b/lib/src/models/table.dart @@ -2,89 +2,90 @@ part of '../../models.dart'; /// Table class Table implements Model { - /// Table ID. - final String $id; + /// Table ID. + final String $id; - /// Table creation date in ISO 8601 format. - final String $createdAt; + /// Table creation date in ISO 8601 format. + final String $createdAt; - /// Table update date in ISO 8601 format. - final String $updatedAt; + /// Table update date in ISO 8601 format. + final String $updatedAt; - /// Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - final List $permissions; + /// Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + final List $permissions; - /// Database ID. - final String databaseId; + /// Database ID. + final String databaseId; - /// Table name. - final String name; + /// Table name. + final String name; - /// Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. - final bool enabled; + /// Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. + final bool enabled; - /// Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - final bool rowSecurity; + /// Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + final bool rowSecurity; - /// Table columns. - final List columns; + /// Table columns. + final List columns; - /// Table indexes. - final List indexes; + /// Table indexes. + final List indexes; - /// Maximum row size in bytes. Returns 0 when no limit applies. - final int bytesMax; + /// Maximum row size in bytes. Returns 0 when no limit applies. + final int bytesMax; - /// Currently used row size in bytes based on defined columns. - final int bytesUsed; + /// Currently used row size in bytes based on defined columns. + final int bytesUsed; - Table({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.$permissions, - required this.databaseId, - required this.name, - required this.enabled, - required this.rowSecurity, - required this.columns, - required this.indexes, - required this.bytesMax, - required this.bytesUsed, - }); + Table({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.$permissions, + required this.databaseId, + required this.name, + required this.enabled, + required this.rowSecurity, + required this.columns, + required this.indexes, + required this.bytesMax, + required this.bytesUsed, + }); - factory Table.fromMap(Map map) { - return Table( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - $permissions: List.from(map['\$permissions'] ?? []), - databaseId: map['databaseId'].toString(), - name: map['name'].toString(), - enabled: map['enabled'], - rowSecurity: map['rowSecurity'], - columns: List.from(map['columns'] ?? []), - indexes: List.from(map['indexes'].map((p) => ColumnIndex.fromMap(p))), - bytesMax: map['bytesMax'], - bytesUsed: map['bytesUsed'], - ); - } + factory Table.fromMap(Map map) { + return Table( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + $permissions: List.from(map['\$permissions'] ?? []), + databaseId: map['databaseId'].toString(), + name: map['name'].toString(), + enabled: map['enabled'], + rowSecurity: map['rowSecurity'], + columns: List.from(map['columns'] ?? []), + indexes: List.from( + map['indexes'].map((p) => ColumnIndex.fromMap(p))), + bytesMax: map['bytesMax'], + bytesUsed: map['bytesUsed'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "\$permissions": $permissions, - "databaseId": databaseId, - "name": name, - "enabled": enabled, - "rowSecurity": rowSecurity, - "columns": columns, - "indexes": indexes.map((p) => p.toMap()).toList(), - "bytesMax": bytesMax, - "bytesUsed": bytesUsed, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "\$permissions": $permissions, + "databaseId": databaseId, + "name": name, + "enabled": enabled, + "rowSecurity": rowSecurity, + "columns": columns, + "indexes": indexes.map((p) => p.toMap()).toList(), + "bytesMax": bytesMax, + "bytesUsed": bytesUsed, + }; + } } diff --git a/lib/src/models/table_list.dart b/lib/src/models/table_list.dart index 7836a60c..1d05be5b 100644 --- a/lib/src/models/table_list.dart +++ b/lib/src/models/table_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Tables List class TableList implements Model { - /// Total number of tables that matched your query. - final int total; + /// Total number of tables that matched your query. + final int total; - /// List of tables. - final List
tables; + /// List of tables. + final List
tables; - TableList({ - required this.total, - required this.tables, - }); + TableList({ + required this.total, + required this.tables, + }); - factory TableList.fromMap(Map map) { - return TableList( - total: map['total'], - tables: List
.from(map['tables'].map((p) => Table.fromMap(p))), - ); - } + factory TableList.fromMap(Map map) { + return TableList( + total: map['total'], + tables: List
.from(map['tables'].map((p) => Table.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "tables": tables.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "tables": tables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/target.dart b/lib/src/models/target.dart index 742e7590..c2e8c4dc 100644 --- a/lib/src/models/target.dart +++ b/lib/src/models/target.dart @@ -2,71 +2,71 @@ part of '../../models.dart'; /// Target class Target implements Model { - /// Target ID. - final String $id; + /// Target ID. + final String $id; - /// Target creation time in ISO 8601 format. - final String $createdAt; + /// Target creation time in ISO 8601 format. + final String $createdAt; - /// Target update date in ISO 8601 format. - final String $updatedAt; + /// Target update date in ISO 8601 format. + final String $updatedAt; - /// Target Name. - final String name; + /// Target Name. + final String name; - /// User ID. - final String userId; + /// User ID. + final String userId; - /// Provider ID. - final String? providerId; + /// Provider ID. + final String? providerId; - /// The target provider type. Can be one of the following: `email`, `sms` or `push`. - final String providerType; + /// The target provider type. Can be one of the following: `email`, `sms` or `push`. + final String providerType; - /// The target identifier. - final String identifier; + /// The target identifier. + final String identifier; - /// Is the target expired. - final bool expired; + /// Is the target expired. + final bool expired; - Target({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.userId, - this.providerId, - required this.providerType, - required this.identifier, - required this.expired, - }); + Target({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.userId, + this.providerId, + required this.providerType, + required this.identifier, + required this.expired, + }); - factory Target.fromMap(Map map) { - return Target( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - userId: map['userId'].toString(), - providerId: map['providerId']?.toString(), - providerType: map['providerType'].toString(), - identifier: map['identifier'].toString(), - expired: map['expired'], - ); - } + factory Target.fromMap(Map map) { + return Target( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + userId: map['userId'].toString(), + providerId: map['providerId']?.toString(), + providerType: map['providerType'].toString(), + identifier: map['identifier'].toString(), + expired: map['expired'], + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "userId": userId, - "providerId": providerId, - "providerType": providerType, - "identifier": identifier, - "expired": expired, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "userId": userId, + "providerId": providerId, + "providerType": providerType, + "identifier": identifier, + "expired": expired, + }; + } } diff --git a/lib/src/models/target_list.dart b/lib/src/models/target_list.dart index 614d1c4e..b4e86bfb 100644 --- a/lib/src/models/target_list.dart +++ b/lib/src/models/target_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Target list class TargetList implements Model { - /// Total number of targets that matched your query. - final int total; + /// Total number of targets that matched your query. + final int total; - /// List of targets. - final List targets; + /// List of targets. + final List targets; - TargetList({ - required this.total, - required this.targets, - }); + TargetList({ + required this.total, + required this.targets, + }); - factory TargetList.fromMap(Map map) { - return TargetList( - total: map['total'], - targets: List.from(map['targets'].map((p) => Target.fromMap(p))), - ); - } + factory TargetList.fromMap(Map map) { + return TargetList( + total: map['total'], + targets: List.from(map['targets'].map((p) => Target.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "targets": targets.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "targets": targets.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/team.dart b/lib/src/models/team.dart index 21e65e95..91b888b9 100644 --- a/lib/src/models/team.dart +++ b/lib/src/models/team.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Team class Team implements Model { - /// Team ID. - final String $id; - - /// Team creation date in ISO 8601 format. - final String $createdAt; - - /// Team update date in ISO 8601 format. - final String $updatedAt; - - /// Team name. - final String name; - - /// Total number of team members. - final int total; - - /// Team preferences as a key-value object - final Preferences prefs; - - Team({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.total, - required this.prefs, - }); - - factory Team.fromMap(Map map) { - return Team( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - total: map['total'], - prefs: Preferences.fromMap(map['prefs']), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "total": total, - "prefs": prefs.toMap(), - }; - } + /// Team ID. + final String $id; + + /// Team creation date in ISO 8601 format. + final String $createdAt; + + /// Team update date in ISO 8601 format. + final String $updatedAt; + + /// Team name. + final String name; + + /// Total number of team members. + final int total; + + /// Team preferences as a key-value object + final Preferences prefs; + + Team({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.total, + required this.prefs, + }); + + factory Team.fromMap(Map map) { + return Team( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + total: map['total'], + prefs: Preferences.fromMap(map['prefs']), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "total": total, + "prefs": prefs.toMap(), + }; + } } diff --git a/lib/src/models/team_list.dart b/lib/src/models/team_list.dart index ffca5e98..e8f1c621 100644 --- a/lib/src/models/team_list.dart +++ b/lib/src/models/team_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Teams List class TeamList implements Model { - /// Total number of teams that matched your query. - final int total; + /// Total number of teams that matched your query. + final int total; - /// List of teams. - final List teams; + /// List of teams. + final List teams; - TeamList({ - required this.total, - required this.teams, - }); + TeamList({ + required this.total, + required this.teams, + }); - factory TeamList.fromMap(Map map) { - return TeamList( - total: map['total'], - teams: List.from(map['teams'].map((p) => Team.fromMap(p))), - ); - } + factory TeamList.fromMap(Map map) { + return TeamList( + total: map['total'], + teams: List.from(map['teams'].map((p) => Team.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "teams": teams.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "teams": teams.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/token.dart b/lib/src/models/token.dart index b05320da..b5ea87c8 100644 --- a/lib/src/models/token.dart +++ b/lib/src/models/token.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Token class Token implements Model { - /// Token ID. - final String $id; - - /// Token creation date in ISO 8601 format. - final String $createdAt; - - /// User ID. - final String userId; - - /// Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - final String secret; - - /// Token expiration date in ISO 8601 format. - final String expire; - - /// Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. - final String phrase; - - Token({ - required this.$id, - required this.$createdAt, - required this.userId, - required this.secret, - required this.expire, - required this.phrase, - }); - - factory Token.fromMap(Map map) { - return Token( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - userId: map['userId'].toString(), - secret: map['secret'].toString(), - expire: map['expire'].toString(), - phrase: map['phrase'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "userId": userId, - "secret": secret, - "expire": expire, - "phrase": phrase, - }; - } + /// Token ID. + final String $id; + + /// Token creation date in ISO 8601 format. + final String $createdAt; + + /// User ID. + final String userId; + + /// Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + final String secret; + + /// Token expiration date in ISO 8601 format. + final String expire; + + /// Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. + final String phrase; + + Token({ + required this.$id, + required this.$createdAt, + required this.userId, + required this.secret, + required this.expire, + required this.phrase, + }); + + factory Token.fromMap(Map map) { + return Token( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + userId: map['userId'].toString(), + secret: map['secret'].toString(), + expire: map['expire'].toString(), + phrase: map['phrase'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "userId": userId, + "secret": secret, + "expire": expire, + "phrase": phrase, + }; + } } diff --git a/lib/src/models/topic.dart b/lib/src/models/topic.dart index b4646d13..d817c799 100644 --- a/lib/src/models/topic.dart +++ b/lib/src/models/topic.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Topic class Topic implements Model { - /// Topic ID. - final String $id; + /// Topic ID. + final String $id; - /// Topic creation time in ISO 8601 format. - final String $createdAt; + /// Topic creation time in ISO 8601 format. + final String $createdAt; - /// Topic update date in ISO 8601 format. - final String $updatedAt; + /// Topic update date in ISO 8601 format. + final String $updatedAt; - /// The name of the topic. - final String name; + /// The name of the topic. + final String name; - /// Total count of email subscribers subscribed to the topic. - final int emailTotal; + /// Total count of email subscribers subscribed to the topic. + final int emailTotal; - /// Total count of SMS subscribers subscribed to the topic. - final int smsTotal; + /// Total count of SMS subscribers subscribed to the topic. + final int smsTotal; - /// Total count of push subscribers subscribed to the topic. - final int pushTotal; + /// Total count of push subscribers subscribed to the topic. + final int pushTotal; - /// Subscribe permissions. - final List subscribe; + /// Subscribe permissions. + final List subscribe; - Topic({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.emailTotal, - required this.smsTotal, - required this.pushTotal, - required this.subscribe, - }); + Topic({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.emailTotal, + required this.smsTotal, + required this.pushTotal, + required this.subscribe, + }); - factory Topic.fromMap(Map map) { - return Topic( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - emailTotal: map['emailTotal'], - smsTotal: map['smsTotal'], - pushTotal: map['pushTotal'], - subscribe: List.from(map['subscribe'] ?? []), - ); - } + factory Topic.fromMap(Map map) { + return Topic( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + emailTotal: map['emailTotal'], + smsTotal: map['smsTotal'], + pushTotal: map['pushTotal'], + subscribe: List.from(map['subscribe'] ?? []), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "emailTotal": emailTotal, - "smsTotal": smsTotal, - "pushTotal": pushTotal, - "subscribe": subscribe, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "emailTotal": emailTotal, + "smsTotal": smsTotal, + "pushTotal": pushTotal, + "subscribe": subscribe, + }; + } } diff --git a/lib/src/models/topic_list.dart b/lib/src/models/topic_list.dart index 9b0ce880..3fb85f7f 100644 --- a/lib/src/models/topic_list.dart +++ b/lib/src/models/topic_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Topic list class TopicList implements Model { - /// Total number of topics that matched your query. - final int total; + /// Total number of topics that matched your query. + final int total; - /// List of topics. - final List topics; + /// List of topics. + final List topics; - TopicList({ - required this.total, - required this.topics, - }); + TopicList({ + required this.total, + required this.topics, + }); - factory TopicList.fromMap(Map map) { - return TopicList( - total: map['total'], - topics: List.from(map['topics'].map((p) => Topic.fromMap(p))), - ); - } + factory TopicList.fromMap(Map map) { + return TopicList( + total: map['total'], + topics: List.from(map['topics'].map((p) => Topic.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "topics": topics.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "topics": topics.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/transaction.dart b/lib/src/models/transaction.dart index e3f3e43d..b0606dd8 100644 --- a/lib/src/models/transaction.dart +++ b/lib/src/models/transaction.dart @@ -2,53 +2,53 @@ part of '../../models.dart'; /// Transaction class Transaction implements Model { - /// Transaction ID. - final String $id; - - /// Transaction creation time in ISO 8601 format. - final String $createdAt; - - /// Transaction update date in ISO 8601 format. - final String $updatedAt; - - /// Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. - final String status; - - /// Number of operations in the transaction. - final int operations; - - /// Expiration time in ISO 8601 format. - final String expiresAt; - - Transaction({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.status, - required this.operations, - required this.expiresAt, - }); - - factory Transaction.fromMap(Map map) { - return Transaction( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - status: map['status'].toString(), - operations: map['operations'], - expiresAt: map['expiresAt'].toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "status": status, - "operations": operations, - "expiresAt": expiresAt, - }; - } + /// Transaction ID. + final String $id; + + /// Transaction creation time in ISO 8601 format. + final String $createdAt; + + /// Transaction update date in ISO 8601 format. + final String $updatedAt; + + /// Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + final String status; + + /// Number of operations in the transaction. + final int operations; + + /// Expiration time in ISO 8601 format. + final String expiresAt; + + Transaction({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.status, + required this.operations, + required this.expiresAt, + }); + + factory Transaction.fromMap(Map map) { + return Transaction( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + status: map['status'].toString(), + operations: map['operations'], + expiresAt: map['expiresAt'].toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "status": status, + "operations": operations, + "expiresAt": expiresAt, + }; + } } diff --git a/lib/src/models/transaction_list.dart b/lib/src/models/transaction_list.dart index 19ea651d..7f321175 100644 --- a/lib/src/models/transaction_list.dart +++ b/lib/src/models/transaction_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Transaction List class TransactionList implements Model { - /// Total number of transactions that matched your query. - final int total; + /// Total number of transactions that matched your query. + final int total; - /// List of transactions. - final List transactions; + /// List of transactions. + final List transactions; - TransactionList({ - required this.total, - required this.transactions, - }); + TransactionList({ + required this.total, + required this.transactions, + }); - factory TransactionList.fromMap(Map map) { - return TransactionList( - total: map['total'], - transactions: List.from(map['transactions'].map((p) => Transaction.fromMap(p))), - ); - } + factory TransactionList.fromMap(Map map) { + return TransactionList( + total: map['total'], + transactions: List.from( + map['transactions'].map((p) => Transaction.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "transactions": transactions.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "transactions": transactions.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/user.dart b/lib/src/models/user.dart index a1da6caf..67b7f448 100644 --- a/lib/src/models/user.dart +++ b/lib/src/models/user.dart @@ -2,143 +2,143 @@ part of '../../models.dart'; /// User class User implements Model { - /// User ID. - final String $id; - - /// User creation date in ISO 8601 format. - final String $createdAt; - - /// User update date in ISO 8601 format. - final String $updatedAt; - - /// User name. - final String name; - - /// Hashed user password. - final String? password; - - /// Password hashing algorithm. - final String? hash; - - /// Password hashing algorithm configuration. - final Map? hashOptions; - - /// User registration date in ISO 8601 format. - final String registration; - - /// User status. Pass `true` for enabled and `false` for disabled. - final bool status; - - /// Labels for the user. - final List labels; - - /// Password update time in ISO 8601 format. - final String passwordUpdate; - - /// User email address. - final String email; - - /// User phone number in E.164 format. - final String phone; - - /// Email verification status. - final bool emailVerification; - - /// Phone verification status. - final bool phoneVerification; - - /// Multi factor authentication status. - final bool mfa; - - /// User preferences as a key-value object - final Preferences prefs; - - /// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. - final List targets; - - /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - final String accessedAt; - - /// Whether the user can impersonate other users. - final bool? impersonator; - - /// ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. - final String? impersonatorUserId; - - User({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - this.password, - this.hash, - this.hashOptions, - required this.registration, - required this.status, - required this.labels, - required this.passwordUpdate, - required this.email, - required this.phone, - required this.emailVerification, - required this.phoneVerification, - required this.mfa, - required this.prefs, - required this.targets, - required this.accessedAt, - this.impersonator, - this.impersonatorUserId, - }); - - factory User.fromMap(Map map) { - return User( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - password: map['password']?.toString(), - hash: map['hash']?.toString(), - hashOptions: map['hashOptions'], - registration: map['registration'].toString(), - status: map['status'], - labels: List.from(map['labels'] ?? []), - passwordUpdate: map['passwordUpdate'].toString(), - email: map['email'].toString(), - phone: map['phone'].toString(), - emailVerification: map['emailVerification'], - phoneVerification: map['phoneVerification'], - mfa: map['mfa'], - prefs: Preferences.fromMap(map['prefs']), - targets: List.from(map['targets'].map((p) => Target.fromMap(p))), - accessedAt: map['accessedAt'].toString(), - impersonator: map['impersonator'], - impersonatorUserId: map['impersonatorUserId']?.toString(), - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "password": password, - "hash": hash, - "hashOptions": hashOptions, - "registration": registration, - "status": status, - "labels": labels, - "passwordUpdate": passwordUpdate, - "email": email, - "phone": phone, - "emailVerification": emailVerification, - "phoneVerification": phoneVerification, - "mfa": mfa, - "prefs": prefs.toMap(), - "targets": targets.map((p) => p.toMap()).toList(), - "accessedAt": accessedAt, - "impersonator": impersonator, - "impersonatorUserId": impersonatorUserId, - }; - } + /// User ID. + final String $id; + + /// User creation date in ISO 8601 format. + final String $createdAt; + + /// User update date in ISO 8601 format. + final String $updatedAt; + + /// User name. + final String name; + + /// Hashed user password. + final String? password; + + /// Password hashing algorithm. + final String? hash; + + /// Password hashing algorithm configuration. + final Map? hashOptions; + + /// User registration date in ISO 8601 format. + final String registration; + + /// User status. Pass `true` for enabled and `false` for disabled. + final bool status; + + /// Labels for the user. + final List labels; + + /// Password update time in ISO 8601 format. + final String passwordUpdate; + + /// User email address. + final String email; + + /// User phone number in E.164 format. + final String phone; + + /// Email verification status. + final bool emailVerification; + + /// Phone verification status. + final bool phoneVerification; + + /// Multi factor authentication status. + final bool mfa; + + /// User preferences as a key-value object + final Preferences prefs; + + /// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + final List targets; + + /// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + final String accessedAt; + + /// Whether the user can impersonate other users. + final bool? impersonator; + + /// ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + final String? impersonatorUserId; + + User({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + this.password, + this.hash, + this.hashOptions, + required this.registration, + required this.status, + required this.labels, + required this.passwordUpdate, + required this.email, + required this.phone, + required this.emailVerification, + required this.phoneVerification, + required this.mfa, + required this.prefs, + required this.targets, + required this.accessedAt, + this.impersonator, + this.impersonatorUserId, + }); + + factory User.fromMap(Map map) { + return User( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + password: map['password']?.toString(), + hash: map['hash']?.toString(), + hashOptions: map['hashOptions'], + registration: map['registration'].toString(), + status: map['status'], + labels: List.from(map['labels'] ?? []), + passwordUpdate: map['passwordUpdate'].toString(), + email: map['email'].toString(), + phone: map['phone'].toString(), + emailVerification: map['emailVerification'], + phoneVerification: map['phoneVerification'], + mfa: map['mfa'], + prefs: Preferences.fromMap(map['prefs']), + targets: List.from(map['targets'].map((p) => Target.fromMap(p))), + accessedAt: map['accessedAt'].toString(), + impersonator: map['impersonator'], + impersonatorUserId: map['impersonatorUserId']?.toString(), + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "password": password, + "hash": hash, + "hashOptions": hashOptions, + "registration": registration, + "status": status, + "labels": labels, + "passwordUpdate": passwordUpdate, + "email": email, + "phone": phone, + "emailVerification": emailVerification, + "phoneVerification": phoneVerification, + "mfa": mfa, + "prefs": prefs.toMap(), + "targets": targets.map((p) => p.toMap()).toList(), + "accessedAt": accessedAt, + "impersonator": impersonator, + "impersonatorUserId": impersonatorUserId, + }; + } } diff --git a/lib/src/models/user_list.dart b/lib/src/models/user_list.dart index 1cad04c9..b8cad001 100644 --- a/lib/src/models/user_list.dart +++ b/lib/src/models/user_list.dart @@ -2,29 +2,29 @@ part of '../../models.dart'; /// Users List class UserList implements Model { - /// Total number of users that matched your query. - final int total; + /// Total number of users that matched your query. + final int total; - /// List of users. - final List users; + /// List of users. + final List users; - UserList({ - required this.total, - required this.users, - }); + UserList({ + required this.total, + required this.users, + }); - factory UserList.fromMap(Map map) { - return UserList( - total: map['total'], - users: List.from(map['users'].map((p) => User.fromMap(p))), - ); - } + factory UserList.fromMap(Map map) { + return UserList( + total: map['total'], + users: List.from(map['users'].map((p) => User.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "users": users.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "users": users.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/variable.dart b/lib/src/models/variable.dart index 284e422c..ce813323 100644 --- a/lib/src/models/variable.dart +++ b/lib/src/models/variable.dart @@ -2,65 +2,65 @@ part of '../../models.dart'; /// Variable class Variable implements Model { - /// Variable ID. - final String $id; + /// Variable ID. + final String $id; - /// Variable creation date in ISO 8601 format. - final String $createdAt; + /// Variable creation date in ISO 8601 format. + final String $createdAt; - /// Variable creation date in ISO 8601 format. - final String $updatedAt; + /// Variable creation date in ISO 8601 format. + final String $updatedAt; - /// Variable key. - final String key; + /// Variable key. + final String key; - /// Variable value. - final String value; + /// Variable value. + final String value; - /// Variable secret flag. Secret variables can only be updated or deleted, but never read. - final bool secret; + /// Variable secret flag. Secret variables can only be updated or deleted, but never read. + final bool secret; - /// Service to which the variable belongs. Possible values are "project", "function" - final String resourceType; + /// Service to which the variable belongs. Possible values are "project", "function" + final String resourceType; - /// ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. - final String resourceId; + /// ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + final String resourceId; - Variable({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.key, - required this.value, - required this.secret, - required this.resourceType, - required this.resourceId, - }); + Variable({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.key, + required this.value, + required this.secret, + required this.resourceType, + required this.resourceId, + }); - factory Variable.fromMap(Map map) { - return Variable( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - key: map['key'].toString(), - value: map['value'].toString(), - secret: map['secret'], - resourceType: map['resourceType'].toString(), - resourceId: map['resourceId'].toString(), - ); - } + factory Variable.fromMap(Map map) { + return Variable( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + key: map['key'].toString(), + value: map['value'].toString(), + secret: map['secret'], + resourceType: map['resourceType'].toString(), + resourceId: map['resourceId'].toString(), + ); + } - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "key": key, - "value": value, - "secret": secret, - "resourceType": resourceType, - "resourceId": resourceId, - }; - } + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "key": key, + "value": value, + "secret": secret, + "resourceType": resourceType, + "resourceId": resourceId, + }; + } } diff --git a/lib/src/models/variable_list.dart b/lib/src/models/variable_list.dart index 4e8b7d9f..6a0e5bad 100644 --- a/lib/src/models/variable_list.dart +++ b/lib/src/models/variable_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Variables List class VariableList implements Model { - /// Total number of variables that matched your query. - final int total; + /// Total number of variables that matched your query. + final int total; - /// List of variables. - final List variables; + /// List of variables. + final List variables; - VariableList({ - required this.total, - required this.variables, - }); + VariableList({ + required this.total, + required this.variables, + }); - factory VariableList.fromMap(Map map) { - return VariableList( - total: map['total'], - variables: List.from(map['variables'].map((p) => Variable.fromMap(p))), - ); - } + factory VariableList.fromMap(Map map) { + return VariableList( + total: map['total'], + variables: + List.from(map['variables'].map((p) => Variable.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "variables": variables.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "variables": variables.map((p) => p.toMap()).toList(), + }; + } } diff --git a/lib/src/models/webhook.dart b/lib/src/models/webhook.dart index 4f732d7b..39f28f43 100644 --- a/lib/src/models/webhook.dart +++ b/lib/src/models/webhook.dart @@ -2,95 +2,95 @@ part of '../../models.dart'; /// Webhook class Webhook implements Model { - /// Webhook ID. - final String $id; - - /// Webhook creation date in ISO 8601 format. - final String $createdAt; - - /// Webhook update date in ISO 8601 format. - final String $updatedAt; - - /// Webhook name. - final String name; - - /// Webhook URL endpoint. - final String url; - - /// Webhook trigger events. - final List events; - - /// Indicates if SSL / TLS certificate verification is enabled. - final bool tls; - - /// HTTP basic authentication username. - final String authUsername; - - /// HTTP basic authentication password. - final String authPassword; - - /// Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. - final String secret; - - /// Indicates if this webhook is enabled. - final bool enabled; - - /// Webhook error logs from the most recent failure. - final String logs; - - /// Number of consecutive failed webhook attempts. - final int attempts; - - Webhook({ - required this.$id, - required this.$createdAt, - required this.$updatedAt, - required this.name, - required this.url, - required this.events, - required this.tls, - required this.authUsername, - required this.authPassword, - required this.secret, - required this.enabled, - required this.logs, - required this.attempts, - }); - - factory Webhook.fromMap(Map map) { - return Webhook( - $id: map['\$id'].toString(), - $createdAt: map['\$createdAt'].toString(), - $updatedAt: map['\$updatedAt'].toString(), - name: map['name'].toString(), - url: map['url'].toString(), - events: List.from(map['events'] ?? []), - tls: map['tls'], - authUsername: map['authUsername'].toString(), - authPassword: map['authPassword'].toString(), - secret: map['secret'].toString(), - enabled: map['enabled'], - logs: map['logs'].toString(), - attempts: map['attempts'], - ); - } - - @override - Map toMap() { - return { - "\$id": $id, - "\$createdAt": $createdAt, - "\$updatedAt": $updatedAt, - "name": name, - "url": url, - "events": events, - "tls": tls, - "authUsername": authUsername, - "authPassword": authPassword, - "secret": secret, - "enabled": enabled, - "logs": logs, - "attempts": attempts, - }; - } + /// Webhook ID. + final String $id; + + /// Webhook creation date in ISO 8601 format. + final String $createdAt; + + /// Webhook update date in ISO 8601 format. + final String $updatedAt; + + /// Webhook name. + final String name; + + /// Webhook URL endpoint. + final String url; + + /// Webhook trigger events. + final List events; + + /// Indicates if SSL / TLS certificate verification is enabled. + final bool tls; + + /// HTTP basic authentication username. + final String authUsername; + + /// HTTP basic authentication password. + final String authPassword; + + /// Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. + final String secret; + + /// Indicates if this webhook is enabled. + final bool enabled; + + /// Webhook error logs from the most recent failure. + final String logs; + + /// Number of consecutive failed webhook attempts. + final int attempts; + + Webhook({ + required this.$id, + required this.$createdAt, + required this.$updatedAt, + required this.name, + required this.url, + required this.events, + required this.tls, + required this.authUsername, + required this.authPassword, + required this.secret, + required this.enabled, + required this.logs, + required this.attempts, + }); + + factory Webhook.fromMap(Map map) { + return Webhook( + $id: map['\$id'].toString(), + $createdAt: map['\$createdAt'].toString(), + $updatedAt: map['\$updatedAt'].toString(), + name: map['name'].toString(), + url: map['url'].toString(), + events: List.from(map['events'] ?? []), + tls: map['tls'], + authUsername: map['authUsername'].toString(), + authPassword: map['authPassword'].toString(), + secret: map['secret'].toString(), + enabled: map['enabled'], + logs: map['logs'].toString(), + attempts: map['attempts'], + ); + } + + @override + Map toMap() { + return { + "\$id": $id, + "\$createdAt": $createdAt, + "\$updatedAt": $updatedAt, + "name": name, + "url": url, + "events": events, + "tls": tls, + "authUsername": authUsername, + "authPassword": authPassword, + "secret": secret, + "enabled": enabled, + "logs": logs, + "attempts": attempts, + }; + } } diff --git a/lib/src/models/webhook_list.dart b/lib/src/models/webhook_list.dart index 2a78380b..5f14cbe4 100644 --- a/lib/src/models/webhook_list.dart +++ b/lib/src/models/webhook_list.dart @@ -2,29 +2,30 @@ part of '../../models.dart'; /// Webhooks List class WebhookList implements Model { - /// Total number of webhooks that matched your query. - final int total; + /// Total number of webhooks that matched your query. + final int total; - /// List of webhooks. - final List webhooks; + /// List of webhooks. + final List webhooks; - WebhookList({ - required this.total, - required this.webhooks, - }); + WebhookList({ + required this.total, + required this.webhooks, + }); - factory WebhookList.fromMap(Map map) { - return WebhookList( - total: map['total'], - webhooks: List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), - ); - } + factory WebhookList.fromMap(Map map) { + return WebhookList( + total: map['total'], + webhooks: + List.from(map['webhooks'].map((p) => Webhook.fromMap(p))), + ); + } - @override - Map toMap() { - return { - "total": total, - "webhooks": webhooks.map((p) => p.toMap()).toList(), - }; - } + @override + Map toMap() { + return { + "total": total, + "webhooks": webhooks.map((p) => p.toMap()).toList(), + }; + } } diff --git a/test/query_test.dart b/test/query_test.dart index 9ef3843a..fc3749f8 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -354,4 +354,3 @@ void main() { expect(query['method'], 'between'); }); } - diff --git a/test/services/account_test.dart b/test/services/account_test.dart index 49699ca1..727e20bb 100644 --- a/test/services/account_test.dart +++ b/test/services/account_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,1458 +37,1287 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Account test', () { - late MockClient client; - late Account account; - - setUp(() { - client = MockClient(); - account = Account(client); - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.get( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.create( - userId: '', - email: 'email@example.com', - password: '', - ); - expect(response, isA()); - - }); - - test('test method updateEmail()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateEmail( - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method listIdentities()', () async { - - final Map data = { - 'total': 5, - 'identities': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.listIdentities( - ); - expect(response, isA()); - - }); - - test('test method deleteIdentity()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.deleteIdentity( - identityId: '', - ); - }); - - test('test method createJWT()', () async { - - final Map data = { - 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createJWT( - ); - expect(response, isA()); - - }); - - test('test method listLogs()', () async { - - final Map data = { - 'total': 5, - 'logs': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.listLogs( - ); - expect(response, isA()); - - }); - - test('test method updateMFA()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMFA( - mfa: true, - ); - expect(response, isA()); - - }); - - test('test method createMfaAuthenticator()', () async { - - final Map data = { - 'secret': '[SHARED_SECRET]', - 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createMfaAuthenticator( - type: enums.AuthenticatorType.totp, - ); - expect(response, isA()); - - }); - - test('test method createMFAAuthenticator()', () async { - - final Map data = { - 'secret': '[SHARED_SECRET]', - 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createMFAAuthenticator( - type: enums.AuthenticatorType.totp, - ); - expect(response, isA()); - - }); - - test('test method updateMfaAuthenticator()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMfaAuthenticator( - type: enums.AuthenticatorType.totp, - otp: '', - ); - expect(response, isA()); - - }); - - test('test method updateMFAAuthenticator()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMFAAuthenticator( - type: enums.AuthenticatorType.totp, - otp: '', - ); - expect(response, isA()); - - }); - - test('test method deleteMfaAuthenticator()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.deleteMfaAuthenticator( - type: enums.AuthenticatorType.totp, - ); - }); - - test('test method deleteMFAAuthenticator()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.deleteMFAAuthenticator( - type: enums.AuthenticatorType.totp, - ); - }); - - test('test method createMfaChallenge()', () async { - - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createMfaChallenge( - factor: enums.AuthenticationFactor.email, - ); - expect(response, isA()); - - }); - - test('test method createMFAChallenge()', () async { - - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createMFAChallenge( - factor: enums.AuthenticationFactor.email, - ); - expect(response, isA()); - - }); - - test('test method updateMfaChallenge()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMfaChallenge( - challengeId: '', - otp: '', - ); - expect(response, isA()); - - }); - - test('test method updateMFAChallenge()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMFAChallenge( - challengeId: '', - otp: '', - ); - expect(response, isA()); - - }); - - test('test method listMfaFactors()', () async { - - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.listMfaFactors( - ); - expect(response, isA()); - - }); - - test('test method listMFAFactors()', () async { - - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.listMFAFactors( - ); - expect(response, isA()); - - }); - - test('test method getMfaRecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.getMfaRecoveryCodes( - ); - expect(response, isA()); - - }); - - test('test method getMFARecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.getMFARecoveryCodes( - ); - expect(response, isA()); - - }); - - test('test method createMfaRecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createMfaRecoveryCodes( - ); - expect(response, isA()); - - }); - - test('test method createMFARecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createMFARecoveryCodes( - ); - expect(response, isA()); - - }); - - test('test method updateMfaRecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMfaRecoveryCodes( - ); - expect(response, isA()); - - }); - - test('test method updateMFARecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMFARecoveryCodes( - ); - expect(response, isA()); - - }); - - test('test method updateName()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateName( - name: '', - ); - expect(response, isA()); - - }); - - test('test method updatePassword()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updatePassword( - password: '', - ); - expect(response, isA()); - - }); - - test('test method updatePhone()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updatePhone( - phone: '+12065550100', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method getPrefs()', () async { - - final Map data = {}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.getPrefs( - ); - expect(response, isA()); - - }); - - test('test method updatePrefs()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + group('Account test', () { + late MockClient client; + late Account account; + setUp(() { + client = MockClient(); + account = Account(client); + }); - final response = await account.updatePrefs( - prefs: {}, - ); - expect(response, isA()); + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.get(); + expect(response, isA()); + }); - }); + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.create( + userId: '', + email: 'email@example.com', + password: '', + ); + expect(response, isA()); + }); - test('test method createRecovery()', () async { + test('test method updateEmail()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateEmail( + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method listIdentities()', () async { + final Map data = { + 'total': 5, + 'identities': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.listIdentities(); + expect(response, isA()); + }); + test('test method deleteIdentity()', () async { + final data = ''; - final response = await account.createRecovery( - email: 'email@example.com', - url: 'https://example.com', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await account.deleteIdentity( + identityId: '', + ); + }); - test('test method updateRecovery()', () async { + test('test method createJWT()', () async { + final Map data = { + 'jwt': + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + }; - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + final response = await account.createJWT(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method listLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await account.updateRecovery( - userId: '', - secret: '', - password: '', - ); - expect(response, isA()); + final response = await account.listLogs(); + expect(response, isA()); + }); - }); + test('test method updateMFA()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateMFA( + mfa: true, + ); + expect(response, isA()); + }); - test('test method listSessions()', () async { - - final Map data = { - 'total': 5, - 'sessions': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.listSessions( - ); - expect(response, isA()); - - }); - - test('test method deleteSessions()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.deleteSessions( - ); - }); - - test('test method createAnonymousSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createAnonymousSession( - ); - expect(response, isA()); - - }); - - test('test method createEmailPasswordSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createEmailPasswordSession( - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method updateMagicURLSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateMagicURLSession( - userId: '', - secret: '', - ); - expect(response, isA()); - - }); - - test('test method updatePhoneSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updatePhoneSession( - userId: '', - secret: '', - ); - expect(response, isA()); - - }); - - test('test method createSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.createSession( - userId: '', - secret: '', - ); - expect(response, isA()); - - }); - - test('test method getSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.getSession( - sessionId: '', - ); - expect(response, isA()); - - }); - - test('test method updateSession()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.updateSession( - sessionId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteSession()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await account.deleteSession( - sessionId: '', - ); - }); - - test('test method updateStatus()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + test('test method createMfaAuthenticator()', () async { + final Map data = { + 'secret': '[SHARED_SECRET]', + 'uri': + 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createMfaAuthenticator( + type: enums.AuthenticatorType.totp, + ); + expect(response, isA()); + }); + test('test method createMFAAuthenticator()', () async { + final Map data = { + 'secret': '[SHARED_SECRET]', + 'uri': + 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createMFAAuthenticator( + type: enums.AuthenticatorType.totp, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateMfaAuthenticator()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateMfaAuthenticator( + type: enums.AuthenticatorType.totp, + otp: '', + ); + expect(response, isA()); + }); + test('test method updateMFAAuthenticator()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateMFAAuthenticator( + type: enums.AuthenticatorType.totp, + otp: '', + ); + expect(response, isA()); + }); - final response = await account.updateStatus( - ); - expect(response, isA()); + test('test method deleteMfaAuthenticator()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method createEmailToken()', () async { + final response = await account.deleteMfaAuthenticator( + type: enums.AuthenticatorType.totp, + ); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method deleteMFAAuthenticator()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.deleteMFAAuthenticator( + type: enums.AuthenticatorType.totp, + ); + }); + test('test method createMfaChallenge()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createMfaChallenge( + factor: enums.AuthenticationFactor.email, + ); + expect(response, isA()); + }); - final response = await account.createEmailToken( - userId: '', - email: 'email@example.com', - ); - expect(response, isA()); + test('test method createMFAChallenge()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createMFAChallenge( + factor: enums.AuthenticationFactor.email, + ); + expect(response, isA()); + }); - }); + test('test method updateMfaChallenge()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateMfaChallenge( + challengeId: '', + otp: '', + ); + expect(response, isA()); + }); - test('test method createMagicURLToken()', () async { + test('test method updateMFAChallenge()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateMFAChallenge( + challengeId: '', + otp: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method listMfaFactors()', () async { + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true, + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.listMfaFactors(); + expect(response, isA()); + }); + test('test method listMFAFactors()', () async { + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true, + }; - final response = await account.createMagicURLToken( - userId: '', - email: 'email@example.com', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await account.listMFAFactors(); + expect(response, isA()); + }); - test('test method createOAuth2Token()', () async { + test('test method getMfaRecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - when(client.webAuth( - Uri(), - )).thenAnswer((_) async => 'done'); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await account.getMfaRecoveryCodes(); + expect(response, isA()); + }); - final response = await account.createOAuth2Token( - provider: enums.OAuthProvider.amazon, - ); - expect(response, isA()); + test('test method getMFARecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createPhoneToken()', () async { + final response = await account.getMFARecoveryCodes(); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method createMfaRecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.createMfaRecoveryCodes(); + expect(response, isA()); + }); + test('test method createMFARecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - final response = await account.createPhoneToken( - userId: '', - phone: '+12065550100', - ); - expect(response, isA()); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await account.createMFARecoveryCodes(); + expect(response, isA()); + }); - test('test method createEmailVerification()', () async { + test('test method updateMfaRecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await account.updateMfaRecoveryCodes(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateMFARecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final response = await account.createEmailVerification( - url: 'https://example.com', - ); - expect(response, isA()); + final response = await account.updateMFARecoveryCodes(); + expect(response, isA()); + }); - }); + test('test method updateName()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateName( + name: '', + ); + expect(response, isA()); + }); - test('test method createVerification()', () async { + test('test method updatePassword()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updatePassword( + password: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method updatePhone()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updatePhone( + phone: '+12065550100', + password: 'password', + ); + expect(response, isA()); + }); + test('test method getPrefs()', () async { + final Map data = {}; - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await account.getPrefs(); + expect(response, isA()); + }); - final response = await account.createVerification( - url: 'https://example.com', - ); - expect(response, isA()); + test('test method updatePrefs()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updatePrefs( + prefs: {}, + ); + expect(response, isA()); + }); - }); + test('test method createRecovery()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', + ); + expect(response, isA()); + }); - test('test method updateEmailVerification()', () async { + test('test method updateRecovery()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateRecovery( + userId: '', + secret: '', + password: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method listSessions()', () async { + final Map data = { + 'total': 5, + 'sessions': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + final response = await account.listSessions(); + expect(response, isA()); + }); + test('test method deleteSessions()', () async { + final data = ''; - final response = await account.updateEmailVerification( - userId: '', - secret: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await account.deleteSessions(); + }); - test('test method updateVerification()', () async { + test('test method createAnonymousSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createAnonymousSession(); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method createEmailPasswordSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); + test('test method updateMagicURLSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateMagicURLSession( + userId: '', + secret: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method updatePhoneSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updatePhoneSession( + userId: '', + secret: '', + ); + expect(response, isA()); + }); + test('test method createSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createSession( + userId: '', + secret: '', + ); + expect(response, isA()); + }); - final response = await account.updateVerification( - userId: '', - secret: '', - ); - expect(response, isA()); + test('test method getSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.getSession( + sessionId: '', + ); + expect(response, isA()); + }); - }); + test('test method updateSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateSession( + sessionId: '', + ); + expect(response, isA()); + }); - test('test method createPhoneVerification()', () async { + test('test method deleteSession()', () async { + final data = ''; - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await account.deleteSession( + sessionId: '', + ); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateStatus(); + expect(response, isA()); + }); + test('test method createEmailToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createEmailToken( + userId: '', + email: 'email@example.com', + ); + expect(response, isA()); + }); - final response = await account.createPhoneVerification( - ); - expect(response, isA()); + test('test method createMagicURLToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createMagicURLToken( + userId: '', + email: 'email@example.com', + ); + expect(response, isA()); + }); - }); + test('test method createOAuth2Token()', () async { + when(client.webAuth( + Uri(), + )).thenAnswer((_) async => 'done'); - test('test method updatePhoneVerification()', () async { + final response = await account.createOAuth2Token( + provider: enums.OAuthProvider.amazon, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + test('test method createPhoneToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createPhoneToken( + userId: '', + phone: '+12065550100', + ); + expect(response, isA()); + }); + test('test method createEmailVerification()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createEmailVerification( + url: 'https://example.com', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method createVerification()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createVerification( + url: 'https://example.com', + ); + expect(response, isA()); + }); + test('test method updateEmailVerification()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateEmailVerification( + userId: '', + secret: '', + ); + expect(response, isA()); + }); - final response = await account.updatePhoneVerification( - userId: '', - secret: '', - ); - expect(response, isA()); + test('test method updateVerification()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updateVerification( + userId: '', + secret: '', + ); + expect(response, isA()); + }); - }); + test('test method createPhoneVerification()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.createPhoneVerification(); + expect(response, isA()); + }); + test('test method updatePhoneVerification()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await account.updatePhoneVerification( + userId: '', + secret: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/activities_test.dart b/test/services/activities_test.dart index 00196437..7a4eead2 100644 --- a/test/services/activities_test.dart +++ b/test/services/activities_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,86 +37,82 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Activities test', () { - late MockClient client; - late Activities activities; + group('Activities test', () { + late MockClient client; + late Activities activities; - setUp(() { - client = MockClient(); - activities = Activities(client); - }); - - test('test method listEvents()', () async { - - final Map data = { - 'total': 5, - 'events': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await activities.listEvents( - ); - expect(response, isA()); - - }); - - test('test method getEvent()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'userType': 'user', - 'userId': '610fc2f985ee0', - 'userEmail': 'john@appwrite.io', - 'userName': 'John Doe', - 'resourceParent': 'database/ID', - 'resourceType': 'collection', - 'resourceId': '610fc2f985ee0', - 'resource': 'collections/610fc2f985ee0', - 'event': 'account.sessions.create', - 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', - 'ip': '127.0.0.1', - 'mode': 'admin', - 'country': 'US', - 'time': '2020-10-15T06:38:00.000+00:00', - 'projectId': '610fc2f985ee0', - 'teamId': '610fc2f985ee0', - 'hostname': 'appwrite.io', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + setUp(() { + client = MockClient(); + activities = Activities(client); + }); + test('test method listEvents()', () async { + final Map data = { + 'total': 5, + 'events': [], + }; - final response = await activities.getEvent( - eventId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await activities.listEvents(); + expect(response, isA()); + }); + test('test method getEvent()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'userType': 'user', + 'userId': '610fc2f985ee0', + 'userEmail': 'john@appwrite.io', + 'userName': 'John Doe', + 'resourceParent': 'database/ID', + 'resourceType': 'collection', + 'resourceId': '610fc2f985ee0', + 'resource': 'collections/610fc2f985ee0', + 'event': 'account.sessions.create', + 'userAgent': + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'ip': '127.0.0.1', + 'mode': 'admin', + 'country': 'US', + 'time': '2020-10-15T06:38:00.000+00:00', + 'projectId': '610fc2f985ee0', + 'teamId': '610fc2f985ee0', + 'hostname': 'appwrite.io', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await activities.getEvent( + eventId: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/avatars_test.dart b/test/services/avatars_test.dart index 3379496e..af27d7d8 100644 --- a/test/services/avatars_test.dart +++ b/test/services/avatars_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,130 +37,123 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Avatars test', () { - late MockClient client; - late Avatars avatars; + group('Avatars test', () { + late MockClient client; + late Avatars avatars; - setUp(() { - client = MockClient(); - avatars = Avatars(client); - }); - - test('test method getBrowser()', () async {final Uint8List data = Uint8List.fromList([]); - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await avatars.getBrowser( - code: enums.Browser.avantBrowser, - ); - expect(response, isA()); - - }); - - test('test method getCreditCard()', () async {final Uint8List data = Uint8List.fromList([]); - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await avatars.getCreditCard( - code: enums.CreditCard.americanExpress, - ); - expect(response, isA()); - - }); - - test('test method getFavicon()', () async {final Uint8List data = Uint8List.fromList([]); - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await avatars.getFavicon( - url: 'https://example.com', - ); - expect(response, isA()); - - }); - - test('test method getFlag()', () async {final Uint8List data = Uint8List.fromList([]); - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + setUp(() { + client = MockClient(); + avatars = Avatars(client); + }); + test('test method getBrowser()', () async { + final Uint8List data = Uint8List.fromList([]); - final response = await avatars.getFlag( - code: enums.Flag.afghanistan, - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await avatars.getBrowser( + code: enums.Browser.avantBrowser, + ); + expect(response, isA()); + }); - test('test method getImage()', () async {final Uint8List data = Uint8List.fromList([]); + test('test method getCreditCard()', () async { + final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await avatars.getCreditCard( + code: enums.CreditCard.americanExpress, + ); + expect(response, isA()); + }); - final response = await avatars.getImage( - url: 'https://example.com', - ); - expect(response, isA()); + test('test method getFavicon()', () async { + final Uint8List data = Uint8List.fromList([]); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getInitials()', () async {final Uint8List data = Uint8List.fromList([]); + final response = await avatars.getFavicon( + url: 'https://example.com', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getFlag()', () async { + final Uint8List data = Uint8List.fromList([]); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await avatars.getInitials( - ); - expect(response, isA()); + final response = await avatars.getFlag( + code: enums.Flag.afghanistan, + ); + expect(response, isA()); + }); - }); + test('test method getImage()', () async { + final Uint8List data = Uint8List.fromList([]); - test('test method getQR()', () async {final Uint8List data = Uint8List.fromList([]); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await avatars.getImage( + url: 'https://example.com', + ); + expect(response, isA()); + }); + test('test method getInitials()', () async { + final Uint8List data = Uint8List.fromList([]); - final response = await avatars.getQR( - text: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await avatars.getInitials(); + expect(response, isA()); + }); - test('test method getScreenshot()', () async {final Uint8List data = Uint8List.fromList([]); + test('test method getQR()', () async { + final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await avatars.getQR( + text: '', + ); + expect(response, isA()); + }); - final response = await avatars.getScreenshot( - url: 'https://example.com', - ); - expect(response, isA()); + test('test method getScreenshot()', () async { + final Uint8List data = Uint8List.fromList([]); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await avatars.getScreenshot( + url: 'https://example.com', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/backups_test.dart b/test/services/backups_test.dart index bdf3684e..89f7da33 100644 --- a/test/services/backups_test.dart +++ b/test/services/backups_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,293 +37,258 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Backups test', () { - late MockClient client; - late Backups backups; + group('Backups test', () { + late MockClient client; + late Backups backups; - setUp(() { - client = MockClient(); - backups = Backups(client); - }); - - test('test method listArchives()', () async { - - final Map data = { - 'total': 5, - 'archives': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.listArchives( - ); - expect(response, isA()); - - }); - - test('test method createArchive()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.createArchive( - services: [enums.BackupServices.databases], - ); - expect(response, isA()); - - }); - - test('test method getArchive()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.getArchive( - archiveId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteArchive()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.deleteArchive( - archiveId: '', - ); - }); - - test('test method listPolicies()', () async { - - final Map data = { - 'total': 5, - 'policies': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.listPolicies( - ); - expect(response, isA()); - - }); - - test('test method createPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.createPolicy( - policyId: '', - services: [enums.BackupServices.databases], - retention: 1, - schedule: '', - ); - expect(response, isA()); - - }); - - test('test method getPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.getPolicy( - policyId: '', - ); - expect(response, isA()); - - }); - - test('test method updatePolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true,}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.updatePolicy( - policyId: '', - ); - expect(response, isA()); - - }); - - test('test method deletePolicy()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await backups.deletePolicy( - policyId: '', - ); - }); + setUp(() { + client = MockClient(); + backups = Backups(client); + }); - test('test method createRestoration()', () async { + test('test method listArchives()', () async { + final Map data = { + 'total': 5, + 'archives': [], + }; - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await backups.listArchives(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method createArchive()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'policyId': 'did8jx6ws45jana098ab7', + 'size': 100000, + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.createArchive( + services: [enums.BackupServices.databases], + ); + expect(response, isA()); + }); + test('test method getArchive()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'policyId': 'did8jx6ws45jana098ab7', + 'size': 100000, + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.getArchive( + archiveId: '', + ); + expect(response, isA()); + }); - final response = await backups.createRestoration( - archiveId: '', - services: [enums.BackupServices.databases], - ); - expect(response, isA()); + test('test method deleteArchive()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method listRestorations()', () async { + final response = await backups.deleteArchive( + archiveId: '', + ); + }); - final Map data = { - 'total': 5, - 'restorations': [],}; + test('test method listPolicies()', () async { + final Map data = { + 'total': 5, + 'policies': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await backups.listPolicies(); + expect(response, isA()); + }); + test('test method createPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.createPolicy( + policyId: '', + services: [enums.BackupServices.databases], + retention: 1, + schedule: '', + ); + expect(response, isA()); + }); - final response = await backups.listRestorations( - ); - expect(response, isA()); + test('test method getPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.getPolicy( + policyId: '', + ); + expect(response, isA()); + }); - }); + test('test method updatePolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.updatePolicy( + policyId: '', + ); + expect(response, isA()); + }); - test('test method getRestoration()', () async { + test('test method deletePolicy()', () async { + final data = ''; - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await backups.deletePolicy( + policyId: '', + ); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createRestoration()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'archiveId': 'did8jx6ws45jana098ab7', + 'policyId': 'did8jx6ws45jana098ab7', + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + 'options': '{databases.database[{oldId, newId, newName}]}', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.createRestoration( + archiveId: '', + services: [enums.BackupServices.databases], + ); + expect(response, isA()); + }); + test('test method listRestorations()', () async { + final Map data = { + 'total': 5, + 'restorations': [], + }; - final response = await backups.getRestoration( - restorationId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await backups.listRestorations(); + expect(response, isA()); + }); + test('test method getRestoration()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'archiveId': 'did8jx6ws45jana098ab7', + 'policyId': 'did8jx6ws45jana098ab7', + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + 'options': '{databases.database[{oldId, newId, newName}]}', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await backups.getRestoration( + restorationId: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index d2936e5b..4781bf22 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,1826 +37,1618 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Databases test', () { - late MockClient client; - late Databases databases; + group('Databases test', () { + late MockClient client; + late Databases databases; - setUp(() { - client = MockClient(); - databases = Databases(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'databases': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.create( - databaseId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method listTransactions()', () async { - - final Map data = { - 'total': 5, - 'transactions': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.listTransactions( - ); - expect(response, isA()); - - }); - - test('test method createTransaction()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createTransaction( - ); - expect(response, isA()); - - }); - - test('test method getTransaction()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.getTransaction( - transactionId: '', - ); - expect(response, isA()); - - }); - - test('test method updateTransaction()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateTransaction( - transactionId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteTransaction()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.deleteTransaction( - transactionId: '', - ); - }); - - test('test method createOperations()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createOperations( - transactionId: '', - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.get( - databaseId: '', - ); - expect(response, isA()); - - }); - - test('test method update()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.update( - databaseId: '', - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.delete( - databaseId: '', - ); - }); - - test('test method listCollections()', () async { - - final Map data = { - 'total': 5, - 'collections': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.listCollections( - databaseId: '', - ); - expect(response, isA()); - - }); - - test('test method createCollection()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createCollection( - databaseId: '', - collectionId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method getCollection()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.getCollection( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - - }); - - test('test method updateCollection()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateCollection( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteCollection()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.deleteCollection( - databaseId: '', - collectionId: '', - ); - }); - - test('test method listAttributes()', () async { - - final Map data = { - 'total': 5, - 'attributes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.listAttributes( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - - }); - - test('test method createBigIntAttribute()', () async { - - final Map data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createBigIntAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateBigIntAttribute()', () async { - - final Map data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateBigIntAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 1, - ); - expect(response, isA()); - - }); - - test('test method createBooleanAttribute()', () async { - - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createBooleanAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateBooleanAttribute()', () async { - - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateBooleanAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: true, - ); - expect(response, isA()); - - }); - - test('test method createDatetimeAttribute()', () async { - - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createDatetimeAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateDatetimeAttribute()', () async { - - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateDatetimeAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '2020-10-15T06:38:00.000+00:00', - ); - expect(response, isA()); - - }); - - test('test method createEmailAttribute()', () async { - - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createEmailAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateEmailAttribute()', () async { - - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateEmailAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 'email@example.com', - ); - expect(response, isA()); - - }); - - test('test method createEnumAttribute()', () async { - - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createEnumAttribute( - databaseId: '', - collectionId: '', - key: '', - elements: [], - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateEnumAttribute()', () async { - - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateEnumAttribute( - databaseId: '', - collectionId: '', - key: '', - elements: [], - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createFloatAttribute()', () async { - - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createFloatAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateFloatAttribute()', () async { - - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateFloatAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 1.0, - ); - expect(response, isA()); - - }); - - test('test method createIntegerAttribute()', () async { - - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createIntegerAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateIntegerAttribute()', () async { - - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateIntegerAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 1, - ); - expect(response, isA()); - - }); - - test('test method createIpAttribute()', () async { - - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createIpAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateIpAttribute()', () async { - - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateIpAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createLineAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createLineAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateLineAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateLineAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method createLongtextAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createLongtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateLongtextAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateLongtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createMediumtextAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createMediumtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateMediumtextAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateMediumtextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createPointAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createPointAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updatePointAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updatePointAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method createPolygonAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createPolygonAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updatePolygonAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updatePolygonAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method createRelationshipAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createRelationshipAttribute( - databaseId: '', - collectionId: '', - relatedCollectionId: '', - type: enums.RelationshipType.oneToOne, - ); - expect(response, isA()); - - }); - - test('test method updateRelationshipAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateRelationshipAttribute( - databaseId: '', - collectionId: '', - key: '', - ); - expect(response, isA()); - - }); - - test('test method createStringAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createStringAttribute( - databaseId: '', - collectionId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateStringAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateStringAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createTextAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createTextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateTextAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateTextAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createUrlAttribute()', () async { - - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createUrlAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateUrlAttribute()', () async { - - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateUrlAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: 'https://example.com', - ); - expect(response, isA()); - - }); - - test('test method createVarcharAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createVarcharAttribute( - databaseId: '', - collectionId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateVarcharAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.updateVarcharAttribute( - databaseId: '', - collectionId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method getAttribute()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.getAttribute( - databaseId: '', - collectionId: '', - key: '', - ); - expect(response, isA()); - - }); - - test('test method deleteAttribute()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.deleteAttribute( - databaseId: '', - collectionId: '', - key: '', - ); - }); - - test('test method listDocuments()', () async { - - final Map data = { - 'total': 5, - 'documents': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.listDocuments( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); - - }); - - test('test method createDocument()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createDocument( - databaseId: '', - collectionId: '', - documentId: '', - data: {}, - ); - expect(response, isA()); - - }); - - test('test method createDocuments()', () async { - - final Map data = { - 'total': 5, - 'documents': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await databases.createDocuments( - databaseId: '', - collectionId: '', - documents: [], - ); - expect(response, isA()); + setUp(() { + client = MockClient(); + databases = Databases(client); + }); - }); + test('test method list()', () async { + final Map data = { + 'total': 5, + 'databases': [], + }; - test('test method upsertDocuments()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'total': 5, - 'documents': [],}; + final response = await databases.list(); + expect(response, isA()); + }); + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.create( + databaseId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method listTransactions()', () async { + final Map data = { + 'total': 5, + 'transactions': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await databases.upsertDocuments( - databaseId: '', - collectionId: '', - documents: [], - ); - expect(response, isA()); + final response = await databases.listTransactions(); + expect(response, isA()); + }); - }); + test('test method createTransaction()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createTransaction(); + expect(response, isA()); + }); - test('test method updateDocuments()', () async { + test('test method getTransaction()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.getTransaction( + transactionId: '', + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'documents': [],}; + test('test method updateTransaction()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateTransaction( + transactionId: '', + ); + expect(response, isA()); + }); + test('test method deleteTransaction()', () async { + final data = ''; - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await databases.deleteTransaction( + transactionId: '', + ); + }); - final response = await databases.updateDocuments( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); + test('test method createOperations()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createOperations( + transactionId: '', + ); + expect(response, isA()); + }); - }); + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.get( + databaseId: '', + ); + expect(response, isA()); + }); - test('test method deleteDocuments()', () async { + test('test method update()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.update( + databaseId: '', + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'documents': [],}; + test('test method delete()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await databases.delete( + databaseId: '', + ); + }); + test('test method listCollections()', () async { + final Map data = { + 'total': 5, + 'collections': [], + }; - final response = await databases.deleteDocuments( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await databases.listCollections( + databaseId: '', + ); + expect(response, isA()); + }); - test('test method getDocument()', () async { + test('test method createCollection()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createCollection( + databaseId: '', + collectionId: '', + name: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method getCollection()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.getCollection( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); + test('test method updateCollection()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500, + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateCollection( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method deleteCollection()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await databases.getDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - expect(response, isA()); + final response = await databases.deleteCollection( + databaseId: '', + collectionId: '', + ); + }); - }); + test('test method listAttributes()', () async { + final Map data = { + 'total': 5, + 'attributes': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.listAttributes( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); - test('test method upsertDocument()', () async { + test('test method createBigIntAttribute()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method updateBigIntAttribute()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateBigIntAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + }); + test('test method createBooleanAttribute()', () async { + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createBooleanAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateBooleanAttribute()', () async { + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateBooleanAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: true, + ); + expect(response, isA()); + }); + test('test method createDatetimeAttribute()', () async { + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createDatetimeAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await databases.upsertDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - expect(response, isA()); + test('test method updateDatetimeAttribute()', () async { + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateDatetimeAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '2020-10-15T06:38:00.000+00:00', + ); + expect(response, isA()); + }); - }); + test('test method createEmailAttribute()', () async { + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createEmailAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method updateDocument()', () async { + test('test method updateEmailAttribute()', () async { + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateEmailAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 'email@example.com', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method createEnumAttribute()', () async { + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createEnumAttribute( + databaseId: '', + collectionId: '', + key: '', + elements: [], + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateEnumAttribute()', () async { + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateEnumAttribute( + databaseId: '', + collectionId: '', + key: '', + elements: [], + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method createFloatAttribute()', () async { + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createFloatAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateFloatAttribute()', () async { + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateFloatAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1.0, + ); + expect(response, isA()); + }); - final response = await databases.updateDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - expect(response, isA()); + test('test method createIntegerAttribute()', () async { + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createIntegerAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - }); + test('test method updateIntegerAttribute()', () async { + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateIntegerAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + }); - test('test method deleteDocument()', () async { + test('test method createIpAttribute()', () async { + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createIpAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final data = ''; + test('test method updateIpAttribute()', () async { + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateIpAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method createLineAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createLineAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateLineAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateLineAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await databases.deleteDocument( - databaseId: '', - collectionId: '', - documentId: '', - ); - }); + test('test method createLongtextAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method decrementDocumentAttribute()', () async { + test('test method updateLongtextAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateLongtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method createMediumtextAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateMediumtextAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateMediumtextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method createPointAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createPointAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updatePointAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updatePointAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await databases.decrementDocumentAttribute( - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - ); - expect(response, isA()); + test('test method createPolygonAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createPolygonAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - }); + test('test method updatePolygonAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updatePolygonAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method incrementDocumentAttribute()', () async { + test('test method createRelationshipAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedCollection': 'collection', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createRelationshipAttribute( + databaseId: '', + collectionId: '', + relatedCollectionId: '', + type: enums.RelationshipType.oneToOne, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method updateRelationshipAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedCollection': 'collection', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateRelationshipAttribute( + databaseId: '', + collectionId: '', + key: '', + ); + expect(response, isA()); + }); + test('test method createStringAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createStringAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateStringAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateStringAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); + test('test method createTextAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createTextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await databases.incrementDocumentAttribute( - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - ); - expect(response, isA()); + test('test method updateTextAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateTextAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - }); + test('test method createUrlAttribute()', () async { + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createUrlAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method listIndexes()', () async { + test('test method updateUrlAttribute()', () async { + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateUrlAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: 'https://example.com', + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'indexes': [],}; + test('test method createVarcharAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateVarcharAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateVarcharAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getAttribute()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.getAttribute( + databaseId: '', + collectionId: '', + key: '', + ); + expect(response, isA()); + }); + test('test method deleteAttribute()', () async { + final data = ''; - final response = await databases.listIndexes( - databaseId: '', - collectionId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await databases.deleteAttribute( + databaseId: '', + collectionId: '', + key: '', + ); + }); - test('test method createIndex()', () async { + test('test method listDocuments()', () async { + final Map data = { + 'total': 5, + 'documents': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.listDocuments( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [],}; + test('test method createDocument()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: {}, + ); + expect(response, isA()); + }); + test('test method createDocuments()', () async { + final Map data = { + 'total': 5, + 'documents': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createDocuments( + databaseId: '', + collectionId: '', + documents: [], + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method upsertDocuments()', () async { + final Map data = { + 'total': 5, + 'documents': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], + ); + expect(response, isA()); + }); + test('test method updateDocuments()', () async { + final Map data = { + 'total': 5, + 'documents': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateDocuments( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); - final response = await databases.createIndex( - databaseId: '', - collectionId: '', - key: '', - type: enums.DatabasesIndexType.key, - attributes: [], - ); - expect(response, isA()); + test('test method deleteDocuments()', () async { + final Map data = { + 'total': 5, + 'documents': [], + }; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.deleteDocuments( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); - }); + test('test method getDocument()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.getDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + expect(response, isA()); + }); - test('test method getIndex()', () async { + test('test method upsertDocument()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.upsertDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [],}; + test('test method updateDocument()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + expect(response, isA()); + }); + test('test method deleteDocument()', () async { + final data = ''; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await databases.deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', + ); + }); - final response = await databases.getIndex( - databaseId: '', - collectionId: '', - key: '', - ); - expect(response, isA()); + test('test method decrementDocumentAttribute()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.decrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + ); + expect(response, isA()); + }); - }); + test('test method incrementDocumentAttribute()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.incrementDocumentAttribute( + databaseId: '', + collectionId: '', + documentId: '', + attribute: '', + ); + expect(response, isA()); + }); - test('test method deleteIndex()', () async { + test('test method listIndexes()', () async { + final Map data = { + 'total': 5, + 'indexes': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.listIndexes( + databaseId: '', + collectionId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method createIndex()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'attributes': [], + 'lengths': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.createIndex( + databaseId: '', + collectionId: '', + key: '', + type: enums.DatabasesIndexType.key, + attributes: [], + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method getIndex()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'attributes': [], + 'lengths': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await databases.getIndex( + databaseId: '', + collectionId: '', + key: '', + ); + expect(response, isA()); + }); + test('test method deleteIndex()', () async { + final data = ''; - final response = await databases.deleteIndex( - databaseId: '', - collectionId: '', - key: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await databases.deleteIndex( + databaseId: '', + collectionId: '', + key: '', + ); }); + }); } diff --git a/test/services/functions_test.dart b/test/services/functions_test.dart index 89397cf4..69da7608 100644 --- a/test/services/functions_test.dart +++ b/test/services/functions_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,825 +37,770 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Functions test', () { - late MockClient client; - late Functions functions; + group('Functions test', () { + late MockClient client; + late Functions functions; - setUp(() { - client = MockClient(); - functions = Functions(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'functions': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.create( - functionId: '', - name: '', - runtime: enums.Runtime.node145, - ); - expect(response, isA()); - - }); - - test('test method listRuntimes()', () async { - - final Map data = { - 'total': 5, - 'runtimes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.listRuntimes( - ); - expect(response, isA()); - - }); - - test('test method listSpecifications()', () async { - - final Map data = { - 'total': 5, - 'specifications': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.listSpecifications( - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.get( - functionId: '', - ); - expect(response, isA()); - - }); - - test('test method update()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.update( - functionId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.delete( - functionId: '', - ); - }); - - test('test method updateFunctionDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.updateFunctionDeployment( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method listDeployments()', () async { - - final Map data = { - 'total': 5, - 'deployments': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.listDeployments( - functionId: '', - ); - expect(response, isA()); - - }); - - test('test method createDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.chunkedUpload( - path: argThat(isNotNull), - params: argThat(isNotNull), - paramName: argThat(isNotNull), - idParamName: argThat(isNotNull), - headers: argThat(isNotNull), - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.createDeployment( - functionId: '', - code: InputFile.fromPath(path: './image.png'), - activate: true, - ); - expect(response, isA()); - - }); - - test('test method createDuplicateDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.createDuplicateDeployment( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method createTemplateDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.createTemplateDeployment( - functionId: '', - repository: '', - owner: '', - rootDirectory: '', - type: enums.TemplateReferenceType.commit, - reference: '', - ); - expect(response, isA()); - - }); - - test('test method createVcsDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.createVcsDeployment( - functionId: '', - type: enums.VCSReferenceType.branch, - reference: '', - ); - expect(response, isA()); - - }); - - test('test method getDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.getDeployment( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteDeployment()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.deleteDeployment( - functionId: '', - deploymentId: '', - ); - }); - - test('test method getDeploymentDownload()', () async {final Uint8List data = Uint8List.fromList([]); - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.getDeploymentDownload( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method updateDeploymentStatus()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.updateDeploymentStatus( - functionId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method listExecutions()', () async { - - final Map data = { - 'total': 5, - 'executions': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.listExecutions( - functionId: '', - ); - expect(response, isA()); - - }); - - test('test method createExecution()', () async { + setUp(() { + client = MockClient(); + functions = Functions(client); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; + test('test method list()', () async { + final Map data = { + 'total': 5, + 'functions': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await functions.createExecution( - functionId: '', - ); - expect(response, isA()); - - }); + final response = await functions.list(); + expect(response, isA()); + }); - test('test method getExecution()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.create( + functionId: '', + name: '', + runtime: enums.Runtime.node145, + ); + expect(response, isA()); + }); + test('test method listRuntimes()', () async { + final Map data = { + 'total': 5, + 'runtimes': [], + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await functions.listRuntimes(); + expect(response, isA()); + }); - final response = await functions.getExecution( - functionId: '', - executionId: '', - ); - expect(response, isA()); + test('test method listSpecifications()', () async { + final Map data = { + 'total': 5, + 'specifications': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteExecution()', () async { + final response = await functions.listSpecifications(); + expect(response, isA()); + }); - final data = ''; + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.get( + functionId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method update()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.update( + functionId: '', + name: '', + ); + expect(response, isA()); + }); + test('test method delete()', () async { + final data = ''; - final response = await functions.deleteExecution( - functionId: '', - executionId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method listVariables()', () async { + final response = await functions.delete( + functionId: '', + ); + }); - final Map data = { - 'total': 5, - 'variables': [],}; + test('test method updateFunctionDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.updateFunctionDeployment( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + }); + test('test method listDeployments()', () async { + final Map data = { + 'total': 5, + 'deployments': [], + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await functions.listDeployments( + functionId: '', + ); + expect(response, isA()); + }); - final response = await functions.listVariables( - functionId: '', - ); - expect(response, isA()); + test('test method createDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.chunkedUpload( + path: argThat(isNotNull), + params: argThat(isNotNull), + paramName: argThat(isNotNull), + idParamName: argThat(isNotNull), + headers: argThat(isNotNull), + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.createDeployment( + functionId: '', + code: InputFile.fromPath(path: './image.png'), + activate: true, + ); + expect(response, isA()); + }); - }); + test('test method createDuplicateDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.createDuplicateDeployment( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + }); - test('test method createVariable()', () async { + test('test method createTemplateDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.createTemplateDeployment( + functionId: '', + repository: '', + owner: '', + rootDirectory: '', + type: enums.TemplateReferenceType.commit, + reference: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + test('test method createVcsDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.createVcsDeployment( + functionId: '', + type: enums.VCSReferenceType.branch, + reference: '', + ); + expect(response, isA()); + }); + test('test method getDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.getDeployment( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method deleteDeployment()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await functions.createVariable( - functionId: '', - variableId: '', - key: '', - value: '', - ); - expect(response, isA()); + final response = await functions.deleteDeployment( + functionId: '', + deploymentId: '', + ); + }); - }); + test('test method getDeploymentDownload()', () async { + final Uint8List data = Uint8List.fromList([]); - test('test method getVariable()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + final response = await functions.getDeploymentDownload( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + }); + test('test method updateDeploymentStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.updateDeploymentStatus( + functionId: '', + deploymentId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listExecutions()', () async { + final Map data = { + 'total': 5, + 'executions': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await functions.getVariable( - functionId: '', - variableId: '', - ); - expect(response, isA()); + final response = await functions.listExecutions( + functionId: '', + ); + expect(response, isA()); + }); - }); + test('test method createExecution()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.createExecution( + functionId: '', + ); + expect(response, isA()); + }); - test('test method updateVariable()', () async { + test('test method getExecution()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.getExecution( + functionId: '', + executionId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + test('test method deleteExecution()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + final response = await functions.deleteExecution( + functionId: '', + executionId: '', + ); + }); + test('test method listVariables()', () async { + final Map data = { + 'total': 5, + 'variables': [], + }; - final response = await functions.updateVariable( - functionId: '', - variableId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await functions.listVariables( + functionId: '', + ); + expect(response, isA()); + }); - test('test method deleteVariable()', () async { + test('test method createVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.createVariable( + functionId: '', + variableId: '', + key: '', + value: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method getVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.getVariable( + functionId: '', + variableId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await functions.updateVariable( + functionId: '', + variableId: '', + ); + expect(response, isA()); + }); + test('test method deleteVariable()', () async { + final data = ''; - final response = await functions.deleteVariable( - functionId: '', - variableId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await functions.deleteVariable( + functionId: '', + variableId: '', + ); }); + }); } diff --git a/test/services/graphql_test.dart b/test/services/graphql_test.dart index de918a21..0b9b9305 100644 --- a/test/services/graphql_test.dart +++ b/test/services/graphql_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,47 +37,45 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Graphql test', () { - late MockClient client; - late Graphql graphql; + group('Graphql test', () { + late MockClient client; + late Graphql graphql; - setUp(() { - client = MockClient(); - graphql = Graphql(client); - }); - - test('test method query()', () async { - - final data = ''; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await graphql.query( - query: {}, - ); - }); + setUp(() { + client = MockClient(); + graphql = Graphql(client); + }); - test('test method mutation()', () async { + test('test method query()', () async { + final data = ''; - final data = ''; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await graphql.query( + query: {}, + ); + }); + test('test method mutation()', () async { + final data = ''; - final response = await graphql.mutation( - query: {}, - ); - }); + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + final response = await graphql.mutation( + query: {}, + ); }); + }); } diff --git a/test/services/health_test.dart b/test/services/health_test.dart index 422d690f..87f8740d 100644 --- a/test/services/health_test.dart +++ b/test/services/health_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,447 +37,354 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Health test', () { - late MockClient client; - late Health health; + group('Health test', () { + late MockClient client; + late Health health; - setUp(() { - client = MockClient(); - health = Health(client); - }); - - test('test method get()', () async { - - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.get( - ); - expect(response, isA()); - - }); - - test('test method getAntivirus()', () async { - - final Map data = { - 'version': '1.0.0', - 'status': 'online',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getAntivirus( - ); - expect(response, isA()); - - }); - - test('test method getCache()', () async { - - final Map data = { - 'total': 5, - 'statuses': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getCache( - ); - expect(response, isA()); - - }); - - test('test method getCertificate()', () async { - - final Map data = { - 'name': '/CN=www.google.com', - 'subjectSN': '', - 'issuerOrganisation': '', - 'validFrom': '1704200998', - 'validTo': '1711458597', - 'signatureTypeSN': 'RSA-SHA256',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getCertificate( - ); - expect(response, isA()); - - }); - - test('test method getConsolePausing()', () async { - - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getConsolePausing( - ); - expect(response, isA()); - - }); - - test('test method getDB()', () async { - - final Map data = { - 'total': 5, - 'statuses': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getDB( - ); - expect(response, isA()); - - }); - - test('test method getPubSub()', () async { - - final Map data = { - 'total': 5, - 'statuses': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getPubSub( - ); - expect(response, isA()); - - }); - - test('test method getQueueAudits()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getQueueAudits( - ); - expect(response, isA()); - - }); - - test('test method getQueueBuilds()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getQueueBuilds( - ); - expect(response, isA()); - - }); - - test('test method getQueueCertificates()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getQueueCertificates( - ); - expect(response, isA()); - - }); - - test('test method getQueueDatabases()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getQueueDatabases( - ); - expect(response, isA()); - - }); - - test('test method getQueueDeletes()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getQueueDeletes( - ); - expect(response, isA()); - - }); - - test('test method getFailedJobs()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getFailedJobs( - name: enums.Name.v1Database, - ); - expect(response, isA()); - - }); - - test('test method getQueueFunctions()', () async { - - final Map data = { - 'size': 8,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await health.getQueueFunctions( - ); - expect(response, isA()); - - }); - - test('test method getQueueLogs()', () async { + setUp(() { + client = MockClient(); + health = Health(client); + }); - final Map data = { - 'size': 8,}; + test('test method get()', () async { + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass', + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await health.get(); + expect(response, isA()); + }); + test('test method getAntivirus()', () async { + final Map data = { + 'version': '1.0.0', + 'status': 'online', + }; - final response = await health.getQueueLogs( - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await health.getAntivirus(); + expect(response, isA()); + }); - test('test method getQueueMails()', () async { + test('test method getCache()', () async { + final Map data = { + 'total': 5, + 'statuses': [], + }; - final Map data = { - 'size': 8,}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getCache(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getCertificate()', () async { + final Map data = { + 'name': '/CN=www.google.com', + 'subjectSN': '', + 'issuerOrganisation': '', + 'validFrom': '1704200998', + 'validTo': '1711458597', + 'signatureTypeSN': 'RSA-SHA256', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await health.getCertificate(); + expect(response, isA()); + }); + test('test method getConsolePausing()', () async { + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass', + }; - final response = await health.getQueueMails( - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await health.getConsolePausing(); + expect(response, isA()); + }); - test('test method getQueueMessaging()', () async { + test('test method getDB()', () async { + final Map data = { + 'total': 5, + 'statuses': [], + }; - final Map data = { - 'size': 8,}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getDB(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getPubSub()', () async { + final Map data = { + 'total': 5, + 'statuses': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueMessaging( - ); - expect(response, isA()); + final response = await health.getPubSub(); + expect(response, isA()); + }); - }); + test('test method getQueueAudits()', () async { + final Map data = { + 'size': 8, + }; - test('test method getQueueMigrations()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'size': 8,}; + final response = await health.getQueueAudits(); + expect(response, isA()); + }); + test('test method getQueueBuilds()', () async { + final Map data = { + 'size': 8, + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getQueueBuilds(); + expect(response, isA()); + }); - final response = await health.getQueueMigrations( - ); - expect(response, isA()); + test('test method getQueueCertificates()', () async { + final Map data = { + 'size': 8, + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getQueueStatsResources()', () async { + final response = await health.getQueueCertificates(); + expect(response, isA()); + }); - final Map data = { - 'size': 8,}; + test('test method getQueueDatabases()', () async { + final Map data = { + 'size': 8, + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await health.getQueueDatabases(); + expect(response, isA()); + }); + test('test method getQueueDeletes()', () async { + final Map data = { + 'size': 8, + }; - final response = await health.getQueueStatsResources( - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await health.getQueueDeletes(); + expect(response, isA()); + }); - test('test method getQueueUsage()', () async { + test('test method getFailedJobs()', () async { + final Map data = { + 'size': 8, + }; - final Map data = { - 'size': 8,}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getFailedJobs( + name: enums.Name.v1Database, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getQueueFunctions()', () async { + final Map data = { + 'size': 8, + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await health.getQueueUsage( - ); - expect(response, isA()); + final response = await health.getQueueFunctions(); + expect(response, isA()); + }); - }); + test('test method getQueueLogs()', () async { + final Map data = { + 'size': 8, + }; - test('test method getQueueWebhooks()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'size': 8,}; + final response = await health.getQueueLogs(); + expect(response, isA()); + }); + test('test method getQueueMails()', () async { + final Map data = { + 'size': 8, + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getQueueMails(); + expect(response, isA()); + }); - final response = await health.getQueueWebhooks( - ); - expect(response, isA()); + test('test method getQueueMessaging()', () async { + final Map data = { + 'size': 8, + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getStorage()', () async { + final response = await health.getQueueMessaging(); + expect(response, isA()); + }); - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; + test('test method getQueueMigrations()', () async { + final Map data = { + 'size': 8, + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await health.getQueueMigrations(); + expect(response, isA()); + }); + test('test method getQueueStatsResources()', () async { + final Map data = { + 'size': 8, + }; - final response = await health.getStorage( - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await health.getQueueStatsResources(); + expect(response, isA()); + }); - test('test method getStorageLocal()', () async { + test('test method getQueueUsage()', () async { + final Map data = { + 'size': 8, + }; - final Map data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getQueueUsage(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getQueueWebhooks()', () async { + final Map data = { + 'size': 8, + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await health.getStorageLocal( - ); - expect(response, isA()); + final response = await health.getQueueWebhooks(); + expect(response, isA()); + }); - }); + test('test method getStorage()', () async { + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass', + }; - test('test method getTime()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'remoteTime': 1639490751, - 'localTime': 1639490844, - 'diff': 93,}; + final response = await health.getStorage(); + expect(response, isA()); + }); + test('test method getStorageLocal()', () async { + final Map data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass', + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getStorageLocal(); + expect(response, isA()); + }); - final response = await health.getTime( - ); - expect(response, isA()); + test('test method getTime()', () async { + final Map data = { + 'remoteTime': 1639490751, + 'localTime': 1639490844, + 'diff': 93, + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await health.getTime(); + expect(response, isA()); }); + }); } diff --git a/test/services/locale_test.dart b/test/services/locale_test.dart index 255c8730..11f13586 100644 --- a/test/services/locale_test.dart +++ b/test/services/locale_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,168 +37,138 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Locale test', () { - late MockClient client; - late Locale locale; + group('Locale test', () { + late MockClient client; + late Locale locale; - setUp(() { - client = MockClient(); - locale = Locale(client); - }); - - test('test method get()', () async { - - final Map data = { - 'ip': '127.0.0.1', - 'countryCode': 'US', - 'country': 'United States', - 'continentCode': 'NA', - 'continent': 'North America', - 'eu': true, - 'currency': 'USD',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await locale.get( - ); - expect(response, isA()); - - }); - - test('test method listCodes()', () async { - - final Map data = { - 'total': 5, - 'localeCodes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await locale.listCodes( - ); - expect(response, isA()); - - }); - - test('test method listContinents()', () async { - - final Map data = { - 'total': 5, - 'continents': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await locale.listContinents( - ); - expect(response, isA()); - - }); - - test('test method listCountries()', () async { - - final Map data = { - 'total': 5, - 'countries': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await locale.listCountries( - ); - expect(response, isA()); - - }); - - test('test method listCountriesEU()', () async { - - final Map data = { - 'total': 5, - 'countries': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await locale.listCountriesEU( - ); - expect(response, isA()); - - }); + setUp(() { + client = MockClient(); + locale = Locale(client); + }); - test('test method listCountriesPhones()', () async { + test('test method get()', () async { + final Map data = { + 'ip': '127.0.0.1', + 'countryCode': 'US', + 'country': 'United States', + 'continentCode': 'NA', + 'continent': 'North America', + 'eu': true, + 'currency': 'USD', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await locale.get(); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'phones': [],}; + test('test method listCodes()', () async { + final Map data = { + 'total': 5, + 'localeCodes': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await locale.listCodes(); + expect(response, isA()); + }); + test('test method listContinents()', () async { + final Map data = { + 'total': 5, + 'continents': [], + }; - final response = await locale.listCountriesPhones( - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await locale.listContinents(); + expect(response, isA()); + }); - test('test method listCurrencies()', () async { + test('test method listCountries()', () async { + final Map data = { + 'total': 5, + 'countries': [], + }; - final Map data = { - 'total': 5, - 'currencies': [],}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await locale.listCountries(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listCountriesEU()', () async { + final Map data = { + 'total': 5, + 'countries': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await locale.listCurrencies( - ); - expect(response, isA()); + final response = await locale.listCountriesEU(); + expect(response, isA()); + }); - }); + test('test method listCountriesPhones()', () async { + final Map data = { + 'total': 5, + 'phones': [], + }; - test('test method listLanguages()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'total': 5, - 'languages': [],}; + final response = await locale.listCountriesPhones(); + expect(response, isA()); + }); + test('test method listCurrencies()', () async { + final Map data = { + 'total': 5, + 'currencies': [], + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await locale.listCurrencies(); + expect(response, isA()); + }); - final response = await locale.listLanguages( - ); - expect(response, isA()); + test('test method listLanguages()', () async { + final Map data = { + 'total': 5, + 'languages': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await locale.listLanguages(); + expect(response, isA()); }); + }); } diff --git a/test/services/messaging_test.dart b/test/services/messaging_test.dart index 21352984..bc1490fc 100644 --- a/test/services/messaging_test.dart +++ b/test/services/messaging_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,1381 +37,1216 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Messaging test', () { - late MockClient client; - late Messaging messaging; - - setUp(() { - client = MockClient(); - messaging = Messaging(client); - }); - - test('test method listMessages()', () async { - - final Map data = { - 'total': 5, - 'messages': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.listMessages( - ); - expect(response, isA()); - - }); - - test('test method createEmail()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createEmail( - messageId: '', - subject: '', - content: '', - ); - expect(response, isA()); - - }); - - test('test method updateEmail()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateEmail( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method createPush()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createPush( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method updatePush()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updatePush( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method createSms()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createSms( - messageId: '', - content: '', - ); - expect(response, isA()); - - }); - - test('test method createSMS()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createSMS( - messageId: '', - content: '', - ); - expect(response, isA()); - - }); - - test('test method updateSms()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateSms( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method updateSMS()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateSMS( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method getMessage()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.getMessage( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.delete( - messageId: '', - ); - }); - - test('test method listMessageLogs()', () async { - - final Map data = { - 'total': 5, - 'logs': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.listMessageLogs( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method listTargets()', () async { - - final Map data = { - 'total': 5, - 'targets': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.listTargets( - messageId: '', - ); - expect(response, isA()); - - }); - - test('test method listProviders()', () async { - - final Map data = { - 'total': 5, - 'providers': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.listProviders( - ); - expect(response, isA()); - - }); - - test('test method createApnsProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createApnsProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method createAPNSProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createAPNSProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateApnsProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateApnsProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method updateAPNSProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateAPNSProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createFcmProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createFcmProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method createFCMProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createFCMProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateFcmProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateFcmProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method updateFCMProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateFCMProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createMailgunProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createMailgunProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateMailgunProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateMailgunProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createMsg91Provider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createMsg91Provider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateMsg91Provider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateMsg91Provider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createResendProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createResendProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateResendProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateResendProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createSendgridProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createSendgridProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateSendgridProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateSendgridProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createSmtpProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createSmtpProvider( - providerId: '', - name: '', - host: '', - ); - expect(response, isA()); - - }); - - test('test method createSMTPProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createSMTPProvider( - providerId: '', - name: '', - host: '', - ); - expect(response, isA()); - - }); - - test('test method updateSmtpProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateSmtpProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method updateSMTPProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateSMTPProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createTelesignProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createTelesignProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateTelesignProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateTelesignProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createTextmagicProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createTextmagicProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateTextmagicProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateTextmagicProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createTwilioProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createTwilioProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateTwilioProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateTwilioProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method createVonageProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.createVonageProvider( - providerId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updateVonageProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.updateVonageProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method getProvider()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await messaging.getProvider( - providerId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteProvider()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + group('Messaging test', () { + late MockClient client; + late Messaging messaging; + setUp(() { + client = MockClient(); + messaging = Messaging(client); + }); - final response = await messaging.deleteProvider( - providerId: '', - ); - }); + test('test method listMessages()', () async { + final Map data = { + 'total': 5, + 'messages': [], + }; - test('test method listProviderLogs()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'total': 5, - 'logs': [],}; + final response = await messaging.listMessages(); + expect(response, isA()); + }); + test('test method createEmail()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createEmail( + messageId: '', + subject: '', + content: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateEmail()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateEmail( + messageId: '', + ); + expect(response, isA()); + }); + test('test method createPush()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createPush( + messageId: '', + ); + expect(response, isA()); + }); - final response = await messaging.listProviderLogs( - providerId: '', - ); - expect(response, isA()); + test('test method updatePush()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updatePush( + messageId: '', + ); + expect(response, isA()); + }); - }); + test('test method createSms()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createSms( + messageId: '', + content: '', + ); + expect(response, isA()); + }); - test('test method listSubscriberLogs()', () async { + test('test method createSMS()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createSMS( + messageId: '', + content: '', + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'logs': [],}; + test('test method updateSms()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateSms( + messageId: '', + ); + expect(response, isA()); + }); + test('test method updateSMS()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateSMS( + messageId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getMessage()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.getMessage( + messageId: '', + ); + expect(response, isA()); + }); + test('test method delete()', () async { + final data = ''; - final response = await messaging.listSubscriberLogs( - subscriberId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await messaging.delete( + messageId: '', + ); + }); - test('test method listTopics()', () async { + test('test method listMessageLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [], + }; - final Map data = { - 'total': 5, - 'topics': [],}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.listMessageLogs( + messageId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listTargets()', () async { + final Map data = { + 'total': 5, + 'targets': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await messaging.listTopics( - ); - expect(response, isA()); + final response = await messaging.listTargets( + messageId: '', + ); + expect(response, isA()); + }); - }); + test('test method listProviders()', () async { + final Map data = { + 'total': 5, + 'providers': [], + }; - test('test method createTopic()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; + final response = await messaging.listProviders(); + expect(response, isA()); + }); + test('test method createApnsProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createApnsProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method createAPNSProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createAPNSProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); + test('test method updateApnsProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateApnsProvider( + providerId: '', + ); + expect(response, isA()); + }); - final response = await messaging.createTopic( - topicId: '', - name: '', - ); - expect(response, isA()); + test('test method updateAPNSProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateAPNSProvider( + providerId: '', + ); + expect(response, isA()); + }); - }); + test('test method createFcmProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createFcmProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - test('test method getTopic()', () async { + test('test method createFCMProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createFCMProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; + test('test method updateFcmProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateFcmProvider( + providerId: '', + ); + expect(response, isA()); + }); + test('test method updateFCMProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateFCMProvider( + providerId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createMailgunProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createMailgunProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); + test('test method updateMailgunProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateMailgunProvider( + providerId: '', + ); + expect(response, isA()); + }); - final response = await messaging.getTopic( - topicId: '', - ); - expect(response, isA()); + test('test method createMsg91Provider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createMsg91Provider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - }); + test('test method updateMsg91Provider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateMsg91Provider( + providerId: '', + ); + expect(response, isA()); + }); - test('test method updateTopic()', () async { + test('test method createResendProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createResendProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; + test('test method updateResendProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateResendProvider( + providerId: '', + ); + expect(response, isA()); + }); + test('test method createSendgridProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createSendgridProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateSendgridProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateSendgridProvider( + providerId: '', + ); + expect(response, isA()); + }); + test('test method createSmtpProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createSmtpProvider( + providerId: '', + name: '', + host: '', + ); + expect(response, isA()); + }); - final response = await messaging.updateTopic( - topicId: '', - ); - expect(response, isA()); + test('test method createSMTPProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createSMTPProvider( + providerId: '', + name: '', + host: '', + ); + expect(response, isA()); + }); - }); + test('test method updateSmtpProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateSmtpProvider( + providerId: '', + ); + expect(response, isA()); + }); - test('test method deleteTopic()', () async { + test('test method updateSMTPProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateSMTPProvider( + providerId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method createTelesignProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createTelesignProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateTelesignProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateTelesignProvider( + providerId: '', + ); + expect(response, isA()); + }); + test('test method createTextmagicProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createTextmagicProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - final response = await messaging.deleteTopic( - topicId: '', - ); - }); + test('test method updateTextmagicProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateTextmagicProvider( + providerId: '', + ); + expect(response, isA()); + }); - test('test method listTopicLogs()', () async { + test('test method createTwilioProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createTwilioProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'logs': [],}; + test('test method updateTwilioProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateTwilioProvider( + providerId: '', + ); + expect(response, isA()); + }); + test('test method createVonageProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createVonageProvider( + providerId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateVonageProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateVonageProvider( + providerId: '', + ); + expect(response, isA()); + }); + test('test method getProvider()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {}, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.getProvider( + providerId: '', + ); + expect(response, isA()); + }); - final response = await messaging.listTopicLogs( - topicId: '', - ); - expect(response, isA()); + test('test method deleteProvider()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method listSubscribers()', () async { + final response = await messaging.deleteProvider( + providerId: '', + ); + }); - final Map data = { - 'total': 5, - 'subscribers': [],}; + test('test method listProviderLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.listProviderLogs( + providerId: '', + ); + expect(response, isA()); + }); + test('test method listSubscriberLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [], + }; - final response = await messaging.listSubscribers( - topicId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await messaging.listSubscriberLogs( + subscriberId: '', + ); + expect(response, isA()); + }); - test('test method createSubscriber()', () async { + test('test method listTopics()', () async { + final Map data = { + 'total': 5, + 'topics': [], + }; - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email',}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.listTopics(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method createTopic()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createTopic( + topicId: '', + name: '', + ); + expect(response, isA()); + }); + test('test method getTopic()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.getTopic( + topicId: '', + ); + expect(response, isA()); + }); - final response = await messaging.createSubscriber( - topicId: '', - subscriberId: '', - targetId: '', - ); - expect(response, isA()); + test('test method updateTopic()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.updateTopic( + topicId: '', + ); + expect(response, isA()); + }); - }); + test('test method deleteTopic()', () async { + final data = ''; - test('test method getSubscriber()', () async { + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true, - }, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email',}; + final response = await messaging.deleteTopic( + topicId: '', + ); + }); + test('test method listTopicLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [], + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.listTopicLogs( + topicId: '', + ); + expect(response, isA()); + }); - final response = await messaging.getSubscriber( - topicId: '', - subscriberId: '', - ); - expect(response, isA()); + test('test method listSubscribers()', () async { + final Map data = { + 'total': 5, + 'subscribers': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteSubscriber()', () async { + final response = await messaging.listSubscribers( + topicId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method createSubscriber()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.createSubscriber( + topicId: '', + subscriberId: '', + targetId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method getSubscriber()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await messaging.getSubscriber( + topicId: '', + subscriberId: '', + ); + expect(response, isA()); + }); + test('test method deleteSubscriber()', () async { + final data = ''; - final response = await messaging.deleteSubscriber( - topicId: '', - subscriberId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await messaging.deleteSubscriber( + topicId: '', + subscriberId: '', + ); }); + }); } diff --git a/test/services/presences_test.dart b/test/services/presences_test.dart index fd6d10b2..d867acf2 100644 --- a/test/services/presences_test.dart +++ b/test/services/presences_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,129 +37,116 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Presences test', () { - late MockClient client; - late Presences presences; + group('Presences test', () { + late MockClient client; + late Presences presences; - setUp(() { - client = MockClient(); - presences = Presences(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'presences': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await presences.list( - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userInternalId': '1', - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await presences.get( - presenceId: '', - ); - expect(response, isA()); - - }); - - test('test method upsert()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userInternalId': '1', - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await presences.upsert( - presenceId: '', - userId: '', - status: '', - ); - expect(response, isA()); - - }); - - test('test method updatePresence()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userInternalId': '1', - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + setUp(() { + client = MockClient(); + presences = Presences(client); + }); + test('test method list()', () async { + final Map data = { + 'total': 5, + 'presences': [], + }; - final response = await presences.updatePresence( - presenceId: '', - userId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await presences.list(); + expect(response, isA()); + }); - test('test method delete()', () async { + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.get( + presenceId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method upsert()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.upsert( + presenceId: '', + userId: '', + status: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updatePresence()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userInternalId': '1', + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await presences.updatePresence( + presenceId: '', + userId: '', + ); + expect(response, isA()); + }); + test('test method delete()', () async { + final data = ''; - final response = await presences.delete( - presenceId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await presences.delete( + presenceId: '', + ); }); + }); } diff --git a/test/services/project_test.dart b/test/services/project_test.dart index a2764af6..745e3387 100644 --- a/test/services/project_test.dart +++ b/test/services/project_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,3201 +37,2897 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Project test', () { - late MockClient client; - late Project project; - - setUp(() { - client = MockClient(); - project = Project(client); - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.delete( - ); - }); - - test('test method updateAuthMethod()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateAuthMethod( - methodId: enums.MethodId.emailPassword, - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method listKeys()', () async { - - final Map data = { - 'total': 5, - 'keys': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.listKeys( - ); - expect(response, isA()); - - }); - - test('test method createKey()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.createKey( - keyId: '', - name: '', - scopes: [enums.Scopes.projectRead], - ); - expect(response, isA()); - - }); - - test('test method createEphemeralKey()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.createEphemeralKey( - scopes: [enums.Scopes.projectRead], - duration: 1, - ); - expect(response, isA()); - - }); - - test('test method getKey()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.getKey( - keyId: '', - ); - expect(response, isA()); - - }); - - test('test method updateKey()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateKey( - keyId: '', - name: '', - scopes: [enums.Scopes.projectRead], - ); - expect(response, isA()); - - }); - - test('test method deleteKey()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.deleteKey( - keyId: '', - ); - }); - - test('test method updateLabels()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateLabels( - labels: [], - ); - expect(response, isA()); - - }); - - test('test method listMockPhones()', () async { - - final Map data = { - 'total': 5, - 'mockNumbers': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.listMockPhones( - ); - expect(response, isA()); - - }); - - test('test method createMockPhone()', () async { - - final Map data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + group('Project test', () { + late MockClient client; + late Project project; + setUp(() { + client = MockClient(); + project = Project(client); + }); - final response = await project.createMockPhone( - number: '+12065550100', - otp: '', - ); - expect(response, isA()); - - }); - - test('test method getMockPhone()', () async { - - final Map data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.getMockPhone( - number: '+12065550100', - ); - expect(response, isA()); - - }); - - test('test method updateMockPhone()', () async { - - final Map data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateMockPhone( - number: '+12065550100', - otp: '', - ); - expect(response, isA()); - - }); - - test('test method deleteMockPhone()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.deleteMockPhone( - number: '+12065550100', - ); - }); - - test('test method listOAuth2Providers()', () async { - - final Map data = { - 'total': 5, - 'providers': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.listOAuth2Providers( - ); - expect(response, isA()); - - }); - - test('test method getOAuth2Provider()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant': 'common',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.getOAuth2Provider( - providerId: enums.ProviderId.amazon, - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Amazon()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', - 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Amazon( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Apple()', () async { - - final Map data = { - '\$id': 'apple', - 'enabled': true, - 'serviceId': 'ip.appwrite.app.web', - 'keyId': 'P4000000N8', - 'teamId': 'D4000000R6', - 'p8File': '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Apple( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Auth0()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'OaOkIA000000000000000000005KLSYq', - 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', - 'endpoint': 'example.us.auth0.com',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Auth0( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Authentik()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', - 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', - 'endpoint': 'example.authentik.com',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Authentik( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Autodesk()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '5zw90v00000000000000000000kVYXN7', - 'clientSecret': '7I000000000000MW',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Autodesk( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Bitbucket()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'key': 'Knt70000000000ByRc', - 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Bitbucket( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Bitly()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'd95151000000000000000000000000000067af9b', - 'clientSecret': 'a13e250000000000000000000000000000d73095',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Bitly( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Box()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'deglcs00000000000000000000x2og6y', - 'clientSecret': 'OKM1f100000000000000000000eshEif',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Box( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Dailymotion()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'apiKey': '07a9000000000000067f', - 'apiSecret': 'a399a90000000000000000000000000000d90639',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Dailymotion( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Discord()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '950722000000343754', - 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Discord( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Disqus()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', - 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Disqus( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Dropbox()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'appKey': 'jl000000000009t', - 'appSecret': 'g200000000000vw',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Dropbox( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Etsy()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'keyString': 'nsgzxh0000000000008j85a2', - 'sharedSecret': 'tp000000ru',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Etsy( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Facebook()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'appId': '260600000007694', - 'appSecret': '2d0b2800000000000000000000d38af4',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Facebook( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Figma()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'byay5H0000000000VtiI40', - 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Figma( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2FusionAuth()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'b2222c00-0000-0000-0000-000000862097', - 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', - 'endpoint': 'example.fusionauth.io',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2FusionAuth( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2GitHub()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'e4d87900000000540733', - 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2GitHub( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Gitlab()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', - 'endpoint': 'https://gitlab.com',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Gitlab( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Google()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'your-google-client-id.apps.googleusercontent.com', - 'clientSecret': 'your-google-client-secret',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Google( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Keycloak()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'appwrite-o0000000st-app', - 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', - 'endpoint': 'keycloak.example.com', - 'realmName': 'appwrite-realm',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Keycloak( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Kick()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '01KQ7C00000000000001MFHS32', - 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Kick( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Linkedin()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '770000000000dv', - 'primaryClientSecret': 'your-linkedin-client-secret',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Linkedin( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Microsoft()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant': 'common',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Microsoft( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Notion()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', - 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Notion( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Oidc()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', - 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', - 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', - 'authorizationURL': 'https://myoauth.com/oauth2/authorize', - 'tokenURL': 'https://myoauth.com/oauth2/token', - 'userInfoURL': 'https://myoauth.com/oauth2/userinfo',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Oidc( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Okta()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '0oa00000000000000698', - 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', - 'domain': 'trial-6400025.okta.com', - 'authorizationServerId': 'aus000000000000000h7z',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Okta( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Paypal()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Paypal( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2PaypalSandbox()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2PaypalSandbox( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Podio()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'appwrite-oauth-test-app', - 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Podio( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Salesforce()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', - 'customerSecret': '3w000000000000e2',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Salesforce( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Slack()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '23000000089.15000000000023', - 'clientSecret': '81656000000000000000000000f3d2fd',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Slack( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Spotify()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6ec271000000000000000000009beace', - 'clientSecret': 'db068a000000000000000000008b5b9f',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Spotify( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Stripe()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'ca_UKibXX0000000000000000000006byvR', - 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Stripe( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Tradeshift()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Tradeshift( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2TradeshiftSandbox()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2TradeshiftSandbox( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2Twitch()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'vvi0in000000000000000000ikmt9p', - 'clientSecret': 'pmapue000000000000000000zylw3v',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateOAuth2Twitch( - ); - expect(response, isA()); - - }); - - test('test method updateOAuth2WordPress()', () async { - - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '130005', - 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; + test('test method delete()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.delete(); + }); + test('test method updateAuthMethod()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateAuthMethod( + methodId: enums.MethodId.emailPassword, + enabled: true, + ); + expect(response, isA()); + }); - final response = await project.updateOAuth2WordPress( - ); - expect(response, isA()); + test('test method listKeys()', () async { + final Map data = { + 'total': 5, + 'keys': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateOAuth2X()', () async { + final response = await project.listKeys(); + expect(response, isA()); + }); - final Map data = { - '\$id': 'github', - 'enabled': true, - 'customerKey': 'slzZV0000000000000NFLaWT', - 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; + test('test method createKey()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createKey( + keyId: '', + name: '', + scopes: [enums.Scopes.projectRead], + ); + expect(response, isA()); + }); + test('test method createEphemeralKey()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createEphemeralKey( + scopes: [enums.Scopes.projectRead], + duration: 1, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method getKey()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getKey( + keyId: '', + ); + expect(response, isA()); + }); + test('test method updateKey()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateKey( + keyId: '', + name: '', + scopes: [enums.Scopes.projectRead], + ); + expect(response, isA()); + }); - final response = await project.updateOAuth2X( - ); - expect(response, isA()); + test('test method deleteKey()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateOAuth2Yahoo()', () async { + final response = await project.deleteKey( + keyId: '', + ); + }); - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', - 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; + test('test method updateLabels()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateLabels( + labels: [], + ); + expect(response, isA()); + }); + test('test method listMockPhones()', () async { + final Map data = { + 'total': 5, + 'mockNumbers': [], + }; - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.listMockPhones(); + expect(response, isA()); + }); - final response = await project.updateOAuth2Yahoo( - ); - expect(response, isA()); + test('test method createMockPhone()', () async { + final Map data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createMockPhone( + number: '+12065550100', + otp: '', + ); + expect(response, isA()); + }); - }); + test('test method getMockPhone()', () async { + final Map data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getMockPhone( + number: '+12065550100', + ); + expect(response, isA()); + }); - test('test method updateOAuth2Yandex()', () async { + test('test method updateMockPhone()', () async { + final Map data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateMockPhone( + number: '+12065550100', + otp: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6a8a6a0000000000000000000091483c', - 'clientSecret': 'bbf98500000000000000000000c75a63',}; + test('test method deleteMockPhone()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.deleteMockPhone( + number: '+12065550100', + ); + }); + test('test method listOAuth2Providers()', () async { + final Map data = { + 'total': 5, + 'providers': [], + }; - final response = await project.updateOAuth2Yandex( - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.listOAuth2Providers(); + expect(response, isA()); + }); - test('test method updateOAuth2Zoho()', () async { + test('test method getOAuth2Provider()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getOAuth2Provider( + providerId: enums.ProviderId.amazon, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '1000.83C178000000000000000000RPNX0B', - 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; + test('test method updateOAuth2Amazon()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + 'clientSecret': + '79ffe4000000000000000000000000000000000000000000000000000002de55', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Amazon(); + expect(response, isA()); + }); + test('test method updateOAuth2Apple()', () async { + final Map data = { + '\$id': 'apple', + 'enabled': true, + 'serviceId': 'ip.appwrite.app.web', + 'keyId': 'P4000000N8', + 'teamId': 'D4000000R6', + 'p8File': + '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Apple(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateOAuth2Auth0()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'OaOkIA000000000000000000005KLSYq', + 'clientSecret': + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + 'endpoint': 'example.us.auth0.com', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Auth0(); + expect(response, isA()); + }); + test('test method updateOAuth2Authentik()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', + 'clientSecret': + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + 'endpoint': 'example.authentik.com', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Authentik(); + expect(response, isA()); + }); - final response = await project.updateOAuth2Zoho( - ); - expect(response, isA()); + test('test method updateOAuth2Autodesk()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '5zw90v00000000000000000000kVYXN7', + 'clientSecret': '7I000000000000MW', + }; - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateOAuth2Zoom()', () async { + final response = await project.updateOAuth2Autodesk(); + expect(response, isA()); + }); - final Map data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'QMAC00000000000000w0AQ', - 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; + test('test method updateOAuth2Bitbucket()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'key': 'Knt70000000000ByRc', + 'secret': 'NMfLZJ00000000000000000000TLQdDx', + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Bitbucket(); + expect(response, isA()); + }); + test('test method updateOAuth2Bitly()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'd95151000000000000000000000000000067af9b', + 'clientSecret': 'a13e250000000000000000000000000000d73095', + }; - final response = await project.updateOAuth2Zoom( - ); - expect(response, isA()); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.updateOAuth2Bitly(); + expect(response, isA()); + }); - test('test method listPlatforms()', () async { + test('test method updateOAuth2Box()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'deglcs00000000000000000000x2og6y', + 'clientSecret': 'OKM1f100000000000000000000eshEif', + }; - final Map data = { - 'total': 5, - 'platforms': [],}; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Box(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateOAuth2Dailymotion()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'apiKey': '07a9000000000000067f', + 'apiSecret': 'a399a90000000000000000000000000000d90639', + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final response = await project.listPlatforms( - ); - expect(response, isA()); + final response = await project.updateOAuth2Dailymotion(); + expect(response, isA()); + }); - }); + test('test method updateOAuth2Discord()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '950722000000343754', + 'clientSecret': 'YmPXnM000000000000000000002zFg5D', + }; - test('test method createAndroidPlatform()', () async { + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname',}; + final response = await project.updateOAuth2Discord(); + expect(response, isA()); + }); + test('test method updateOAuth2Disqus()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'publicKey': + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + 'secretKey': + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Disqus(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateOAuth2Dropbox()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'appKey': 'jl000000000009t', + 'appSecret': 'g200000000000vw', + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final response = await project.createAndroidPlatform( - platformId: '', - name: '', - applicationId: '', - ); - expect(response, isA()); + final response = await project.updateOAuth2Dropbox(); + expect(response, isA()); + }); - }); + test('test method updateOAuth2Etsy()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'keyString': 'nsgzxh0000000000008j85a2', + 'sharedSecret': 'tp000000ru', + }; - test('test method updateAndroidPlatform()', () async { + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname',}; + final response = await project.updateOAuth2Etsy(); + expect(response, isA()); + }); + test('test method updateOAuth2Facebook()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'appId': '260600000007694', + 'appSecret': '2d0b2800000000000000000000d38af4', + }; - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Facebook(); + expect(response, isA()); + }); - final response = await project.updateAndroidPlatform( - platformId: '', - name: '', - applicationId: '', - ); - expect(response, isA()); + test('test method updateOAuth2Figma()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'byay5H0000000000VtiI40', + 'clientSecret': 'yEpOYn0000000000000000004iIsU5', + }; - }); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - test('test method createApplePlatform()', () async { + final response = await project.updateOAuth2Figma(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname',}; + test('test method updateOAuth2FusionAuth()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'b2222c00-0000-0000-0000-000000862097', + 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', + 'endpoint': 'example.fusionauth.io', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2FusionAuth(); + expect(response, isA()); + }); + test('test method updateOAuth2GitHub()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'e4d87900000000540733', + 'clientSecret': '5e07c00000000000000000000000000000198bcc', + }; - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2GitHub(); + expect(response, isA()); + }); - final response = await project.createApplePlatform( - platformId: '', - name: '', - bundleIdentifier: '', - ); - expect(response, isA()); + test('test method updateOAuth2Gitlab()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + 'secret': + 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + 'endpoint': 'https://gitlab.com', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Gitlab(); + expect(response, isA()); + }); - }); + test('test method updateOAuth2Google()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'your-google-client-id.apps.googleusercontent.com', + 'clientSecret': 'your-google-client-secret', + }; - test('test method updateApplePlatform()', () async { + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname',}; + final response = await project.updateOAuth2Google(); + expect(response, isA()); + }); + test('test method updateOAuth2Keycloak()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-o0000000st-app', + 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', + 'endpoint': 'keycloak.example.com', + 'realmName': 'appwrite-realm', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Keycloak(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateOAuth2Kick()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '01KQ7C00000000000001MFHS32', + 'clientSecret': + '34ac5600000000000000000000000000000000000000000000000000e830c8b', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Kick(); + expect(response, isA()); + }); + test('test method updateOAuth2Linkedin()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '770000000000dv', + 'primaryClientSecret': 'your-linkedin-client-secret', + }; - final response = await project.updateApplePlatform( - platformId: '', - name: '', - bundleIdentifier: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.updateOAuth2Linkedin(); + expect(response, isA()); + }); - test('test method createLinuxPlatform()', () async { + test('test method updateOAuth2Microsoft()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Microsoft(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; + test('test method updateOAuth2Notion()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', + 'oauthClientSecret': + 'secret_dLUr4b000000000000000000000000000000lFHAa9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Notion(); + expect(response, isA()); + }); + test('test method updateOAuth2Oidc()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', + 'clientSecret': + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', + 'authorizationURL': 'https://myoauth.com/oauth2/authorize', + 'tokenURL': 'https://myoauth.com/oauth2/token', + 'userInfoURL': 'https://myoauth.com/oauth2/userinfo', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Oidc(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateOAuth2Okta()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '0oa00000000000000698', + 'clientSecret': + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + 'domain': 'trial-6400025.okta.com', + 'authorizationServerId': 'aus000000000000000h7z', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Okta(); + expect(response, isA()); + }); + test('test method updateOAuth2Paypal()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Paypal(); + expect(response, isA()); + }); - final response = await project.createLinuxPlatform( - platformId: '', - name: '', - packageName: '', - ); - expect(response, isA()); + test('test method updateOAuth2PaypalSandbox()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2PaypalSandbox(); + expect(response, isA()); + }); - }); + test('test method updateOAuth2Podio()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-oauth-test-app', + 'clientSecret': + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Podio(); + expect(response, isA()); + }); - test('test method updateLinuxPlatform()', () async { + test('test method updateOAuth2Salesforce()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + 'customerSecret': '3w000000000000e2', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Salesforce(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; + test('test method updateOAuth2Slack()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '23000000089.15000000000023', + 'clientSecret': '81656000000000000000000000f3d2fd', + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Slack(); + expect(response, isA()); + }); + test('test method updateOAuth2Spotify()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6ec271000000000000000000009beace', + 'clientSecret': 'db068a000000000000000000008b5b9f', + }; - final response = await project.updateLinuxPlatform( - platformId: '', - name: '', - packageName: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.updateOAuth2Spotify(); + expect(response, isA()); + }); - test('test method createWebPlatform()', () async { + test('test method updateOAuth2Stripe()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'ca_UKibXX0000000000000000000006byvR', + 'apiSecretKey': + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Stripe(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com',}; + test('test method updateOAuth2Tradeshift()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83', + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Tradeshift(); + expect(response, isA()); + }); + test('test method updateOAuth2TradeshiftSandbox()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83', + }; - final response = await project.createWebPlatform( - platformId: '', - name: '', - hostname: 'app.example.com', - ); - expect(response, isA()); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.updateOAuth2TradeshiftSandbox(); + expect(response, isA()); + }); - test('test method updateWebPlatform()', () async { + test('test method updateOAuth2Twitch()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'vvi0in000000000000000000ikmt9p', + 'clientSecret': 'pmapue000000000000000000zylw3v', + }; - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com',}; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Twitch(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateOAuth2WordPress()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '130005', + 'clientSecret': + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2WordPress(); + expect(response, isA()); + }); + test('test method updateOAuth2X()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': 'slzZV0000000000000NFLaWT', + 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9', + }; - final response = await project.updateWebPlatform( - platformId: '', - name: '', - hostname: 'app.example.com', - ); - expect(response, isA()); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.updateOAuth2X(); + expect(response, isA()); + }); - test('test method createWindowsPlatform()', () async { + test('test method updateOAuth2Yahoo()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateOAuth2Yahoo(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname',}; + test('test method updateOAuth2Yandex()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6a8a6a0000000000000000000091483c', + 'clientSecret': 'bbf98500000000000000000000c75a63', + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Yandex(); + expect(response, isA()); + }); + test('test method updateOAuth2Zoho()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '1000.83C178000000000000000000RPNX0B', + 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e', + }; - final response = await project.createWindowsPlatform( - platformId: '', - name: '', - packageIdentifierName: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.updateOAuth2Zoho(); + expect(response, isA()); + }); - test('test method updateWindowsPlatform()', () async { + test('test method updateOAuth2Zoom()', () async { + final Map data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'QMAC00000000000000w0AQ', + 'clientSecret': 'GAWsG4000000000000000000007U01ON', + }; - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname',}; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.updateOAuth2Zoom(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method listPlatforms()', () async { + final Map data = { + 'total': 5, + 'platforms': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await project.updateWindowsPlatform( - platformId: '', - name: '', - packageIdentifierName: '', - ); - expect(response, isA()); + final response = await project.listPlatforms(); + expect(response, isA()); + }); - }); - - test('test method getPlatform()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.getPlatform( - platformId: '', - ); - expect(response, isA()); - - }); - - test('test method deletePlatform()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.deletePlatform( - platformId: '', - ); - }); - - test('test method listPolicies()', () async { - - final Map data = { - 'total': 9, - 'policies': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.listPolicies( - ); - expect(response, isA()); - - }); - - test('test method updateMembershipPrivacyPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateMembershipPrivacyPolicy( - ); - expect(response, isA()); - - }); - - test('test method updatePasswordDictionaryPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updatePasswordDictionaryPolicy( - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method updatePasswordHistoryPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updatePasswordHistoryPolicy( - total: 1, - ); - expect(response, isA()); - - }); - - test('test method updatePasswordPersonalDataPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updatePasswordPersonalDataPolicy( - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method updateSessionAlertPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateSessionAlertPolicy( - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method updateSessionDurationPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateSessionDurationPolicy( - duration: 1, - ); - expect(response, isA()); - - }); - - test('test method updateSessionInvalidationPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateSessionInvalidationPolicy( - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method updateSessionLimitPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateSessionLimitPolicy( - total: 1, - ); - expect(response, isA()); - - }); - - test('test method updateUserLimitPolicy()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateUserLimitPolicy( - total: 1, - ); - expect(response, isA()); - - }); - - test('test method getPolicy()', () async { - - final Map data = { - '\$id': 'password-dictionary', - 'userId': true, - 'userEmail': true, - 'userPhone': true, - 'userName': true, - 'userMFA': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.getPolicy( - policyId: enums.PolicyId.passwordDictionary, - ); - expect(response, isA()); - - }); - - test('test method updateProtocol()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateProtocol( - protocolId: enums.ProtocolId.rest, - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method updateService()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateService( - serviceId: enums.ServiceId.account, - enabled: true, - ); - expect(response, isA()); - - }); - - test('test method updateSMTP()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'description': 'This is a new project.', - 'teamId': '1592981250', - 'logo': '5f5c451b403cb', - 'url': '5f5c451b403cb', - 'legalName': 'Company LTD.', - 'legalCountry': 'US', - 'legalState': 'New York', - 'legalCity': 'New York City.', - 'legalAddress': '620 Eighth Avenue, New York, NY 10018', - 'legalTaxId': '131102020', - 'authDuration': 60, - 'authLimit': 100, - 'authSessionsLimit': 10, - 'authPasswordHistory': 5, - 'authPasswordDictionary': true, - 'authPersonalDataCheck': true, - 'authDisposableEmails': true, - 'authCanonicalEmails': true, - 'authFreeEmails': true, - 'authMockNumbers': [], - 'authSessionAlerts': true, - 'authMembershipsUserName': true, - 'authMembershipsUserEmail': true, - 'authMembershipsMfa': true, - 'authMembershipsUserId': true, - 'authMembershipsUserPhone': true, - 'authInvalidateSessions': true, - 'oAuthProviders': [], - 'platforms': [], - 'webhooks': [], - 'keys': [], - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authEmailPassword': true, - 'authUsersAuthMagicURL': true, - 'authEmailOtp': true, - 'authAnonymous': true, - 'authInvites': true, - 'authJWT': true, - 'authPhone': true, - 'serviceStatusForAccount': true, - 'serviceStatusForAvatars': true, - 'serviceStatusForDatabases': true, - 'serviceStatusForTablesdb': true, - 'serviceStatusForLocale': true, - 'serviceStatusForHealth': true, - 'serviceStatusForProject': true, - 'serviceStatusForStorage': true, - 'serviceStatusForTeams': true, - 'serviceStatusForUsers': true, - 'serviceStatusForVcs': true, - 'serviceStatusForSites': true, - 'serviceStatusForFunctions': true, - 'serviceStatusForProxy': true, - 'serviceStatusForGraphql': true, - 'serviceStatusForMigrations': true, - 'serviceStatusForMessaging': true, - 'protocolStatusForRest': true, - 'protocolStatusForGraphql': true, - 'protocolStatusForWebsocket': true, - 'region': 'fra', - 'billingLimits': { - 'bandwidth': 5, - 'storage': 150, - 'users': 200000, - 'executions': 750000, - 'GBHours': 100, - 'imageTransformations': 100, - 'authPhone': 10, - 'budgetLimit': 100, - }, - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.updateSMTP( - ); - expect(response, isA()); - - }); - - test('test method createSMTPTest()', () async { - - final data = ''; - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.createSMTPTest( - emails: [], - ); - }); - - test('test method listEmailTemplates()', () async { - - final Map data = { - 'total': 5, - 'templates': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await project.listEmailTemplates( - ); - expect(response, isA()); - - }); - - test('test method updateEmailTemplate()', () async { - - final Map data = { - 'templateId': 'verification', - 'locale': 'en_us', - 'message': 'Click on the link to verify your account.', - 'senderName': 'My User', - 'senderEmail': 'mail@appwrite.io', - 'replyToEmail': 'emails@appwrite.io', - 'replyToName': 'Support Team', - 'subject': 'Please verify your email address',}; + test('test method createAndroidPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createAndroidPlatform( + platformId: '', + name: '', + applicationId: '', + ); + expect(response, isA()); + }); + test('test method updateAndroidPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateAndroidPlatform( + platformId: '', + name: '', + applicationId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method createApplePlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createApplePlatform( + platformId: '', + name: '', + bundleIdentifier: '', + ); + expect(response, isA()); + }); + test('test method updateApplePlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateApplePlatform( + platformId: '', + name: '', + bundleIdentifier: '', + ); + expect(response, isA()); + }); - final response = await project.updateEmailTemplate( - templateId: enums.EmailTemplateType.verification, - ); - expect(response, isA()); + test('test method createLinuxPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createLinuxPlatform( + platformId: '', + name: '', + packageName: '', + ); + expect(response, isA()); + }); - }); + test('test method updateLinuxPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateLinuxPlatform( + platformId: '', + name: '', + packageName: '', + ); + expect(response, isA()); + }); - test('test method getEmailTemplate()', () async { + test('test method createWebPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createWebPlatform( + platformId: '', + name: '', + hostname: 'app.example.com', + ); + expect(response, isA()); + }); - final Map data = { - 'templateId': 'verification', - 'locale': 'en_us', - 'message': 'Click on the link to verify your account.', - 'senderName': 'My User', - 'senderEmail': 'mail@appwrite.io', - 'replyToEmail': 'emails@appwrite.io', - 'replyToName': 'Support Team', - 'subject': 'Please verify your email address',}; + test('test method updateWebPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateWebPlatform( + platformId: '', + name: '', + hostname: 'app.example.com', + ); + expect(response, isA()); + }); + test('test method createWindowsPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createWindowsPlatform( + platformId: '', + name: '', + packageIdentifierName: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateWindowsPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateWindowsPlatform( + platformId: '', + name: '', + packageIdentifierName: '', + ); + expect(response, isA()); + }); + test('test method getPlatform()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getPlatform( + platformId: '', + ); + expect(response, isA()); + }); - final response = await project.getEmailTemplate( - templateId: enums.EmailTemplateType.verification, - ); - expect(response, isA()); + test('test method deletePlatform()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method listVariables()', () async { + final response = await project.deletePlatform( + platformId: '', + ); + }); - final Map data = { - 'total': 5, - 'variables': [],}; + test('test method listPolicies()', () async { + final Map data = { + 'total': 9, + 'policies': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await project.listPolicies(); + expect(response, isA()); + }); + test('test method updateMembershipPrivacyPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateMembershipPrivacyPolicy(); + expect(response, isA()); + }); - final response = await project.listVariables( - ); - expect(response, isA()); + test('test method updatePasswordDictionaryPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updatePasswordDictionaryPolicy( + enabled: true, + ); + expect(response, isA()); + }); - }); + test('test method updatePasswordHistoryPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updatePasswordHistoryPolicy( + total: 1, + ); + expect(response, isA()); + }); - test('test method createVariable()', () async { + test('test method updatePasswordPersonalDataPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updatePasswordPersonalDataPolicy( + enabled: true, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + test('test method updateSessionAlertPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionAlertPolicy( + enabled: true, + ); + expect(response, isA()); + }); + test('test method updateSessionDurationPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionDurationPolicy( + duration: 1, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateSessionInvalidationPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionInvalidationPolicy( + enabled: true, + ); + expect(response, isA()); + }); + test('test method updateSessionLimitPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSessionLimitPolicy( + total: 1, + ); + expect(response, isA()); + }); - final response = await project.createVariable( - variableId: '', - key: '', - value: '', - ); - expect(response, isA()); + test('test method updateUserLimitPolicy()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateUserLimitPolicy( + total: 1, + ); + expect(response, isA()); + }); - }); + test('test method getPolicy()', () async { + final Map data = { + '\$id': 'password-dictionary', + 'userId': true, + 'userEmail': true, + 'userPhone': true, + 'userName': true, + 'userMFA': true, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getPolicy( + policyId: enums.PolicyId.passwordDictionary, + ); + expect(response, isA()); + }); - test('test method getVariable()', () async { + test('test method updateProtocol()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateProtocol( + protocolId: enums.ProtocolId.rest, + enabled: true, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + test('test method updateService()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateService( + serviceId: enums.ServiceId.account, + enabled: true, + ); + expect(response, isA()); + }); + test('test method updateSMTP()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'description': 'This is a new project.', + 'teamId': '1592981250', + 'logo': '5f5c451b403cb', + 'url': '5f5c451b403cb', + 'legalName': 'Company LTD.', + 'legalCountry': 'US', + 'legalState': 'New York', + 'legalCity': 'New York City.', + 'legalAddress': '620 Eighth Avenue, New York, NY 10018', + 'legalTaxId': '131102020', + 'authDuration': 60, + 'authLimit': 100, + 'authSessionsLimit': 10, + 'authPasswordHistory': 5, + 'authPasswordDictionary': true, + 'authPersonalDataCheck': true, + 'authDisposableEmails': true, + 'authCanonicalEmails': true, + 'authFreeEmails': true, + 'authMockNumbers': [], + 'authSessionAlerts': true, + 'authMembershipsUserName': true, + 'authMembershipsUserEmail': true, + 'authMembershipsMfa': true, + 'authMembershipsUserId': true, + 'authMembershipsUserPhone': true, + 'authInvalidateSessions': true, + 'oAuthProviders': [], + 'platforms': [], + 'webhooks': [], + 'keys': [], + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authEmailPassword': true, + 'authUsersAuthMagicURL': true, + 'authEmailOtp': true, + 'authAnonymous': true, + 'authInvites': true, + 'authJWT': true, + 'authPhone': true, + 'serviceStatusForAccount': true, + 'serviceStatusForAvatars': true, + 'serviceStatusForDatabases': true, + 'serviceStatusForTablesdb': true, + 'serviceStatusForLocale': true, + 'serviceStatusForHealth': true, + 'serviceStatusForProject': true, + 'serviceStatusForStorage': true, + 'serviceStatusForTeams': true, + 'serviceStatusForUsers': true, + 'serviceStatusForVcs': true, + 'serviceStatusForSites': true, + 'serviceStatusForFunctions': true, + 'serviceStatusForProxy': true, + 'serviceStatusForGraphql': true, + 'serviceStatusForMigrations': true, + 'serviceStatusForMessaging': true, + 'protocolStatusForRest': true, + 'protocolStatusForGraphql': true, + 'protocolStatusForWebsocket': true, + 'region': 'fra', + 'billingLimits': { + 'bandwidth': 5, + 'storage': 150, + 'users': 200000, + 'executions': 750000, + 'GBHours': 100, + 'imageTransformations': 100, + 'authPhone': 10, + 'budgetLimit': 100, + }, + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateSMTP(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createSMTPTest()', () async { + final data = ''; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await project.getVariable( - variableId: '', - ); - expect(response, isA()); + final response = await project.createSMTPTest( + emails: [], + ); + }); - }); + test('test method listEmailTemplates()', () async { + final Map data = { + 'total': 5, + 'templates': [], + }; - test('test method updateVariable()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + final response = await project.listEmailTemplates(); + expect(response, isA()); + }); + test('test method updateEmailTemplate()', () async { + final Map data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateEmailTemplate( + templateId: enums.EmailTemplateType.verification, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method getEmailTemplate()', () async { + final Map data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getEmailTemplate( + templateId: enums.EmailTemplateType.verification, + ); + expect(response, isA()); + }); + test('test method listVariables()', () async { + final Map data = { + 'total': 5, + 'variables': [], + }; - final response = await project.updateVariable( - variableId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await project.listVariables(); + expect(response, isA()); + }); - test('test method deleteVariable()', () async { + test('test method createVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.createVariable( + variableId: '', + key: '', + value: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method getVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.getVariable( + variableId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await project.updateVariable( + variableId: '', + ); + expect(response, isA()); + }); + test('test method deleteVariable()', () async { + final data = ''; - final response = await project.deleteVariable( - variableId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await project.deleteVariable( + variableId: '', + ); }); + }); } diff --git a/test/services/proxy_test.dart b/test/services/proxy_test.dart index f22b0a33..5fe1334e 100644 --- a/test/services/proxy_test.dart +++ b/test/services/proxy_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,243 +37,227 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Proxy test', () { - late MockClient client; - late Proxy proxy; + group('Proxy test', () { + late MockClient client; + late Proxy proxy; - setUp(() { - client = MockClient(); - proxy = Proxy(client); - }); - - test('test method listRules()', () async { - - final Map data = { - 'total': 5, - 'rules': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await proxy.listRules( - ); - expect(response, isA()); - - }); - - test('test method createAPIRule()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await proxy.createAPIRule( - domain: '', - ); - expect(response, isA()); - - }); - - test('test method createFunctionRule()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await proxy.createFunctionRule( - domain: '', - functionId: '', - ); - expect(response, isA()); - - }); - - test('test method createRedirectRule()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await proxy.createRedirectRule( - domain: '', - url: 'https://example.com', - statusCode: enums.StatusCode.movedPermanently301, - resourceId: '', - resourceType: enums.ProxyResourceType.site, - ); - expect(response, isA()); - - }); - - test('test method createSiteRule()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await proxy.createSiteRule( - domain: '', - siteId: '', - ); - expect(response, isA()); - - }); - - test('test method getRule()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await proxy.getRule( - ruleId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteRule()', () async { + setUp(() { + client = MockClient(); + proxy = Proxy(client); + }); - final data = ''; + test('test method listRules()', () async { + final Map data = { + 'total': 5, + 'rules': [], + }; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await proxy.listRules(); + expect(response, isA()); + }); - final response = await proxy.deleteRule( - ruleId: '', - ); - }); + test('test method createAPIRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createAPIRule( + domain: '', + ); + expect(response, isA()); + }); - test('test method updateRuleStatus()', () async { + test('test method createFunctionRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createFunctionRule( + domain: '', + functionId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; + test('test method createRedirectRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createRedirectRule( + domain: '', + url: 'https://example.com', + statusCode: enums.StatusCode.movedPermanently301, + resourceId: '', + resourceType: enums.ProxyResourceType.site, + ); + expect(response, isA()); + }); + test('test method createSiteRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.createSiteRule( + domain: '', + siteId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method getRule()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.getRule( + ruleId: '', + ); + expect(response, isA()); + }); + test('test method deleteRule()', () async { + final data = ''; - final response = await proxy.updateRuleStatus( - ruleId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await proxy.deleteRule( + ruleId: '', + ); + }); + test('test method updateRuleStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await proxy.updateRuleStatus( + ruleId: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/sites_test.dart b/test/services/sites_test.dart index 0815eaa3..fdce85ec 100644 --- a/test/services/sites_test.dart +++ b/test/services/sites_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,800 +37,748 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Sites test', () { - late MockClient client; - late Sites sites; - - setUp(() { - client = MockClient(); - sites = Sites(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'sites': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.create( - siteId: '', - name: '', - framework: enums.Framework.analog, - buildRuntime: enums.BuildRuntime.node145, - ); - expect(response, isA()); - - }); - - test('test method listFrameworks()', () async { - - final Map data = { - 'total': 5, - 'frameworks': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.listFrameworks( - ); - expect(response, isA()); - - }); - - test('test method listSpecifications()', () async { - - final Map data = { - 'total': 5, - 'specifications': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.listSpecifications( - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.get( - siteId: '', - ); - expect(response, isA()); - - }); - - test('test method update()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.update( - siteId: '', - name: '', - framework: enums.Framework.analog, - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.delete( - siteId: '', - ); - }); - - test('test method updateSiteDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.updateSiteDeployment( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method listDeployments()', () async { - - final Map data = { - 'total': 5, - 'deployments': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.listDeployments( - siteId: '', - ); - expect(response, isA()); - - }); - - test('test method createDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.chunkedUpload( - path: argThat(isNotNull), - params: argThat(isNotNull), - paramName: argThat(isNotNull), - idParamName: argThat(isNotNull), - headers: argThat(isNotNull), - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.createDeployment( - siteId: '', - code: InputFile.fromPath(path: './image.png'), - ); - expect(response, isA()); - - }); - - test('test method createDuplicateDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.createDuplicateDeployment( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method createTemplateDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.createTemplateDeployment( - siteId: '', - repository: '', - owner: '', - rootDirectory: '', - type: enums.TemplateReferenceType.branch, - reference: '', - ); - expect(response, isA()); - - }); - - test('test method createVcsDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.createVcsDeployment( - siteId: '', - type: enums.VCSReferenceType.branch, - reference: '', - ); - expect(response, isA()); - - }); - - test('test method getDeployment()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.getDeployment( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteDeployment()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.deleteDeployment( - siteId: '', - deploymentId: '', - ); - }); - - test('test method getDeploymentDownload()', () async {final Uint8List data = Uint8List.fromList([]); - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.getDeploymentDownload( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method updateDeploymentStatus()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await sites.updateDeploymentStatus( - siteId: '', - deploymentId: '', - ); - expect(response, isA()); - - }); - - test('test method listLogs()', () async { - - final Map data = { - 'total': 5, - 'executions': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + group('Sites test', () { + late MockClient client; + late Sites sites; + setUp(() { + client = MockClient(); + sites = Sites(client); + }); - final response = await sites.listLogs( - siteId: '', - ); - expect(response, isA()); + test('test method list()', () async { + final Map data = { + 'total': 5, + 'sites': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getLog()', () async { + final response = await sites.list(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.create( + siteId: '', + name: '', + framework: enums.Framework.analog, + buildRuntime: enums.BuildRuntime.node145, + ); + expect(response, isA()); + }); + test('test method listFrameworks()', () async { + final Map data = { + 'total': 5, + 'frameworks': [], + }; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await sites.listFrameworks(); + expect(response, isA()); + }); - final response = await sites.getLog( - siteId: '', - logId: '', - ); - expect(response, isA()); + test('test method listSpecifications()', () async { + final Map data = { + 'total': 5, + 'specifications': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteLog()', () async { + final response = await sites.listSpecifications(); + expect(response, isA()); + }); - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.get( + siteId: '', + ); + expect(response, isA()); + }); + test('test method update()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.update( + siteId: '', + name: '', + framework: enums.Framework.analog, + ); + expect(response, isA()); + }); - final response = await sites.deleteLog( - siteId: '', - logId: '', - ); - }); + test('test method delete()', () async { + final data = ''; - test('test method listVariables()', () async { + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'total': 5, - 'variables': [],}; + final response = await sites.delete( + siteId: '', + ); + }); + test('test method updateSiteDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.updateSiteDeployment( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listDeployments()', () async { + final Map data = { + 'total': 5, + 'deployments': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await sites.listVariables( - siteId: '', - ); - expect(response, isA()); + final response = await sites.listDeployments( + siteId: '', + ); + expect(response, isA()); + }); - }); + test('test method createDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.chunkedUpload( + path: argThat(isNotNull), + params: argThat(isNotNull), + paramName: argThat(isNotNull), + idParamName: argThat(isNotNull), + headers: argThat(isNotNull), + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.createDeployment( + siteId: '', + code: InputFile.fromPath(path: './image.png'), + ); + expect(response, isA()); + }); - test('test method createVariable()', () async { + test('test method createDuplicateDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.createDuplicateDeployment( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + test('test method createTemplateDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.createTemplateDeployment( + siteId: '', + repository: '', + owner: '', + rootDirectory: '', + type: enums.TemplateReferenceType.branch, + reference: '', + ); + expect(response, isA()); + }); + test('test method createVcsDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.createVcsDeployment( + siteId: '', + type: enums.VCSReferenceType.branch, + reference: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method getDeployment()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.getDeployment( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + }); + test('test method deleteDeployment()', () async { + final data = ''; - final response = await sites.createVariable( - siteId: '', - variableId: '', - key: '', - value: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await sites.deleteDeployment( + siteId: '', + deploymentId: '', + ); + }); - test('test method getVariable()', () async { + test('test method getDeploymentDownload()', () async { + final Uint8List data = Uint8List.fromList([]); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await sites.getDeploymentDownload( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateDeploymentStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': + 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.updateDeploymentStatus( + siteId: '', + deploymentId: '', + ); + expect(response, isA()); + }); + test('test method listLogs()', () async { + final Map data = { + 'total': 5, + 'executions': [], + }; - final response = await sites.getVariable( - siteId: '', - variableId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await sites.listLogs( + siteId: '', + ); + expect(response, isA()); + }); - test('test method updateVariable()', () async { + test('test method getLog()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.getLog( + siteId: '', + logId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; + test('test method deleteLog()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + final response = await sites.deleteLog( + siteId: '', + logId: '', + ); + }); + test('test method listVariables()', () async { + final Map data = { + 'total': 5, + 'variables': [], + }; - final response = await sites.updateVariable( - siteId: '', - variableId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await sites.listVariables( + siteId: '', + ); + expect(response, isA()); + }); - test('test method deleteVariable()', () async { + test('test method createVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.createVariable( + siteId: '', + variableId: '', + key: '', + value: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method getVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.getVariable( + siteId: '', + variableId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateVariable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await sites.updateVariable( + siteId: '', + variableId: '', + ); + expect(response, isA()); + }); + test('test method deleteVariable()', () async { + final data = ''; - final response = await sites.deleteVariable( - siteId: '', - variableId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await sites.deleteVariable( + siteId: '', + variableId: '', + ); }); + }); } diff --git a/test/services/storage_test.dart b/test/services/storage_test.dart index fc585135..b6f8b202 100644 --- a/test/services/storage_test.dart +++ b/test/services/storage_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,323 +37,293 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Storage test', () { - late MockClient client; - late Storage storage; - - setUp(() { - client = MockClient(); - storage = Storage(client); - }); - - test('test method listBuckets()', () async { - - final Map data = { - 'total': 5, - 'buckets': [],}; + group('Storage test', () { + late MockClient client; + late Storage storage; + setUp(() { + client = MockClient(); + storage = Storage(client); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.listBuckets( - ); - expect(response, isA()); - - }); - - test('test method createBucket()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.createBucket( - bucketId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method getBucket()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.getBucket( - bucketId: '', - ); - expect(response, isA()); - - }); - - test('test method updateBucket()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.updateBucket( - bucketId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method deleteBucket()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.deleteBucket( - bucketId: '', - ); - }); - - test('test method listFiles()', () async { - - final Map data = { - 'total': 5, - 'files': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.listFiles( - bucketId: '', - ); - expect(response, isA()); - - }); - - test('test method createFile()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; - - - when(client.chunkedUpload( - path: argThat(isNotNull), - params: argThat(isNotNull), - paramName: argThat(isNotNull), - idParamName: argThat(isNotNull), - headers: argThat(isNotNull), - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.createFile( - bucketId: '', - fileId: '', - file: InputFile.fromPath(path: './image.png'), - ); - expect(response, isA()); - - }); - - test('test method getFile()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await storage.getFile( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - - }); - - test('test method updateFile()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; + test('test method listBuckets()', () async { + final Map data = { + 'total': 5, + 'buckets': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + final response = await storage.listBuckets(); + expect(response, isA()); + }); + test('test method createBucket()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await storage.createBucket( + bucketId: '', + name: '', + ); + expect(response, isA()); + }); - final response = await storage.updateFile( - bucketId: '', - fileId: '', - ); - expect(response, isA()); + test('test method getBucket()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await storage.getBucket( + bucketId: '', + ); + expect(response, isA()); + }); - }); + test('test method updateBucket()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128, + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await storage.updateBucket( + bucketId: '', + name: '', + ); + expect(response, isA()); + }); - test('test method deleteFile()', () async { + test('test method deleteBucket()', () async { + final data = ''; - final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + final response = await storage.deleteBucket( + bucketId: '', + ); + }); + test('test method listFiles()', () async { + final Map data = { + 'total': 5, + 'files': [], + }; - final response = await storage.deleteFile( - bucketId: '', - fileId: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method getFileDownload()', () async {final Uint8List data = Uint8List.fromList([]); + final response = await storage.listFiles( + bucketId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createFile()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip', + }; + + when(client.chunkedUpload( + path: argThat(isNotNull), + params: argThat(isNotNull), + paramName: argThat(isNotNull), + idParamName: argThat(isNotNull), + headers: argThat(isNotNull), + )).thenAnswer((_) async => Response(data: data)); + + final response = await storage.createFile( + bucketId: '', + fileId: '', + file: InputFile.fromPath(path: './image.png'), + ); + expect(response, isA()); + }); + test('test method getFile()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await storage.getFile( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + }); - final response = await storage.getFileDownload( - bucketId: '', - fileId: '', - ); - expect(response, isA()); + test('test method updateFile()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await storage.updateFile( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + }); - }); + test('test method deleteFile()', () async { + final data = ''; - test('test method getFilePreview()', () async {final Uint8List data = Uint8List.fromList([]); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + final response = await storage.deleteFile( + bucketId: '', + fileId: '', + ); + }); + test('test method getFileDownload()', () async { + final Uint8List data = Uint8List.fromList([]); - final response = await storage.getFilePreview( - bucketId: '', - fileId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await storage.getFileDownload( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + }); - test('test method getFileView()', () async {final Uint8List data = Uint8List.fromList([]); + test('test method getFilePreview()', () async { + final Uint8List data = Uint8List.fromList([]); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await storage.getFilePreview( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + }); - final response = await storage.getFileView( - bucketId: '', - fileId: '', - ); - expect(response, isA()); + test('test method getFileView()', () async { + final Uint8List data = Uint8List.fromList([]); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await storage.getFileView( + bucketId: '', + fileId: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/tables_db_test.dart b/test/services/tables_db_test.dart index dbfd3962..d0d0a7e9 100644 --- a/test/services/tables_db_test.dart +++ b/test/services/tables_db_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,1826 +37,1618 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('TablesDB test', () { - late MockClient client; - late TablesDB tablesDB; + group('TablesDB test', () { + late MockClient client; + late TablesDB tablesDB; - setUp(() { - client = MockClient(); - tablesDB = TablesDB(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'databases': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.create( - databaseId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method listTransactions()', () async { - - final Map data = { - 'total': 5, - 'transactions': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.listTransactions( - ); - expect(response, isA()); - - }); - - test('test method createTransaction()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createTransaction( - ); - expect(response, isA()); - - }); - - test('test method getTransaction()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.getTransaction( - transactionId: '', - ); - expect(response, isA()); - - }); - - test('test method updateTransaction()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateTransaction( - transactionId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteTransaction()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.deleteTransaction( - transactionId: '', - ); - }); - - test('test method createOperations()', () async { - - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createOperations( - transactionId: '', - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.get( - databaseId: '', - ); - expect(response, isA()); - - }); - - test('test method update()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.update( - databaseId: '', - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.delete( - databaseId: '', - ); - }); - - test('test method listTables()', () async { - - final Map data = { - 'total': 5, - 'tables': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.listTables( - databaseId: '', - ); - expect(response, isA()); - - }); - - test('test method createTable()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createTable( - databaseId: '', - tableId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method getTable()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.getTable( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - - }); - - test('test method updateTable()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateTable( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - - }); - - test('test method deleteTable()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.deleteTable( - databaseId: '', - tableId: '', - ); - }); - - test('test method listColumns()', () async { - - final Map data = { - 'total': 5, - 'columns': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.listColumns( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - - }); - - test('test method createBigIntColumn()', () async { - - final Map data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createBigIntColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateBigIntColumn()', () async { - - final Map data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateBigIntColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 1, - ); - expect(response, isA()); - - }); - - test('test method createBooleanColumn()', () async { - - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createBooleanColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateBooleanColumn()', () async { - - final Map data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateBooleanColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: true, - ); - expect(response, isA()); - - }); - - test('test method createDatetimeColumn()', () async { - - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createDatetimeColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateDatetimeColumn()', () async { - - final Map data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateDatetimeColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '2020-10-15T06:38:00.000+00:00', - ); - expect(response, isA()); - - }); - - test('test method createEmailColumn()', () async { - - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createEmailColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateEmailColumn()', () async { - - final Map data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateEmailColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 'email@example.com', - ); - expect(response, isA()); - - }); - - test('test method createEnumColumn()', () async { - - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createEnumColumn( - databaseId: '', - tableId: '', - key: '', - elements: [], - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateEnumColumn()', () async { - - final Map data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateEnumColumn( - databaseId: '', - tableId: '', - key: '', - elements: [], - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createFloatColumn()', () async { - - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createFloatColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateFloatColumn()', () async { - - final Map data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateFloatColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 1.0, - ); - expect(response, isA()); - - }); - - test('test method createIntegerColumn()', () async { - - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createIntegerColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateIntegerColumn()', () async { - - final Map data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateIntegerColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 1, - ); - expect(response, isA()); - - }); - - test('test method createIpColumn()', () async { - - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createIpColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateIpColumn()', () async { - - final Map data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateIpColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createLineColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createLineColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateLineColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateLineColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method createLongtextColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createLongtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateLongtextColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateLongtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createMediumtextColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createMediumtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateMediumtextColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateMediumtextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createPointColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createPointColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updatePointColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updatePointColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method createPolygonColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createPolygonColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updatePolygonColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updatePolygonColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method createRelationshipColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createRelationshipColumn( - databaseId: '', - tableId: '', - relatedTableId: '', - type: enums.RelationshipType.oneToOne, - ); - expect(response, isA()); - - }); - - test('test method createStringColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createStringColumn( - databaseId: '', - tableId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateStringColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateStringColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createTextColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createTextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateTextColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateTextColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method createUrlColumn()', () async { - - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createUrlColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateUrlColumn()', () async { - - final Map data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateUrlColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: 'https://example.com', - ); - expect(response, isA()); - - }); - - test('test method createVarcharColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createVarcharColumn( - databaseId: '', - tableId: '', - key: '', - size: 1, - xrequired: true, - ); - expect(response, isA()); - - }); - - test('test method updateVarcharColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateVarcharColumn( - databaseId: '', - tableId: '', - key: '', - xrequired: true, - xdefault: '', - ); - expect(response, isA()); - - }); - - test('test method getColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.getColumn( - databaseId: '', - tableId: '', - key: '', - ); - expect(response, isA()); - - }); - - test('test method deleteColumn()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.deleteColumn( - databaseId: '', - tableId: '', - key: '', - ); - }); - - test('test method updateRelationshipColumn()', () async { - - final Map data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.updateRelationshipColumn( - databaseId: '', - tableId: '', - key: '', - ); - expect(response, isA()); - - }); - - test('test method listIndexes()', () async { - - final Map data = { - 'total': 5, - 'indexes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.listIndexes( - databaseId: '', - tableId: '', - ); - expect(response, isA()); - - }); - - test('test method createIndex()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.createIndex( - databaseId: '', - tableId: '', - key: '', - type: enums.TablesDBIndexType.key, - columns: [], - ); - expect(response, isA()); - - }); - - test('test method getIndex()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tablesDB.getIndex( - databaseId: '', - tableId: '', - key: '', - ); - expect(response, isA()); + setUp(() { + client = MockClient(); + tablesDB = TablesDB(client); + }); - }); + test('test method list()', () async { + final Map data = { + 'total': 5, + 'databases': [], + }; - test('test method deleteIndex()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final data = ''; + final response = await tablesDB.list(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.create( + databaseId: '', + name: '', + ); + expect(response, isA()); + }); + test('test method listTransactions()', () async { + final Map data = { + 'total': 5, + 'transactions': [], + }; - final response = await tablesDB.deleteIndex( - databaseId: '', - tableId: '', - key: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method listRows()', () async { + final response = await tablesDB.listTransactions(); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'rows': [],}; + test('test method createTransaction()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createTransaction(); + expect(response, isA()); + }); + test('test method getTransaction()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.getTransaction( + transactionId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateTransaction()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateTransaction( + transactionId: '', + ); + expect(response, isA()); + }); + test('test method deleteTransaction()', () async { + final data = ''; - final response = await tablesDB.listRows( - databaseId: '', - tableId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await tablesDB.deleteTransaction( + transactionId: '', + ); + }); - test('test method createRow()', () async { + test('test method createOperations()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createOperations( + transactionId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.get( + databaseId: '', + ); + expect(response, isA()); + }); + test('test method update()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.update( + databaseId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method delete()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.createRow( - databaseId: '', - tableId: '', - rowId: '', - data: {}, - ); - expect(response, isA()); + final response = await tablesDB.delete( + databaseId: '', + ); + }); - }); + test('test method listTables()', () async { + final Map data = { + 'total': 5, + 'tables': [], + }; - test('test method createRows()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'total': 5, - 'rows': [],}; + final response = await tablesDB.listTables( + databaseId: '', + ); + expect(response, isA()); + }); + test('test method createTable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createTable( + databaseId: '', + tableId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method getTable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.getTable( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); + test('test method updateTable()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500, + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateTable( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); - final response = await tablesDB.createRows( - databaseId: '', - tableId: '', - rows: [], - ); - expect(response, isA()); + test('test method deleteTable()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method upsertRows()', () async { + final response = await tablesDB.deleteTable( + databaseId: '', + tableId: '', + ); + }); - final Map data = { - 'total': 5, - 'rows': [],}; + test('test method listColumns()', () async { + final Map data = { + 'total': 5, + 'columns': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.listColumns( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); + test('test method createBigIntColumn()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateBigIntColumn()', () async { + final Map data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateBigIntColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + }); + test('test method createBooleanColumn()', () async { + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createBooleanColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await tablesDB.upsertRows( - databaseId: '', - tableId: '', - rows: [], - ); - expect(response, isA()); + test('test method updateBooleanColumn()', () async { + final Map data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateBooleanColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: true, + ); + expect(response, isA()); + }); - }); + test('test method createDatetimeColumn()', () async { + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method updateRows()', () async { + test('test method updateDatetimeColumn()', () async { + final Map data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateDatetimeColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '2020-10-15T06:38:00.000+00:00', + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'rows': [],}; + test('test method createEmailColumn()', () async { + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createEmailColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateEmailColumn()', () async { + final Map data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateEmailColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 'email@example.com', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method createEnumColumn()', () async { + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateEnumColumn()', () async { + final Map data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateEnumColumn( + databaseId: '', + tableId: '', + key: '', + elements: [], + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - final response = await tablesDB.updateRows( - databaseId: '', - tableId: '', - ); - expect(response, isA()); + test('test method createFloatColumn()', () async { + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createFloatColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - }); + test('test method updateFloatColumn()', () async { + final Map data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateFloatColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1.0, + ); + expect(response, isA()); + }); - test('test method deleteRows()', () async { + test('test method createIntegerColumn()', () async { + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createIntegerColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final Map data = { - 'total': 5, - 'rows': [],}; + test('test method updateIntegerColumn()', () async { + final Map data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateIntegerColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 1, + ); + expect(response, isA()); + }); + test('test method createIpColumn()', () async { + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createIpColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateIpColumn()', () async { + final Map data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateIpColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); + test('test method createLineColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createLineColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await tablesDB.deleteRows( - databaseId: '', - tableId: '', - ); - expect(response, isA()); + test('test method updateLineColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateLineColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - }); + test('test method createLongtextColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createLongtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method getRow()', () async { + test('test method updateLongtextColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateLongtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method createMediumtextColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateMediumtextColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateMediumtextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createPointColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createPointColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updatePointColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updatePointColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - final response = await tablesDB.getRow( - databaseId: '', - tableId: '', - rowId: '', - ); - expect(response, isA()); + test('test method createPolygonColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createPolygonColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - }); + test('test method updatePolygonColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updatePolygonColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - test('test method upsertRow()', () async { + test('test method createRelationshipColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedTable': 'table', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createRelationshipColumn( + databaseId: '', + tableId: '', + relatedTableId: '', + type: enums.RelationshipType.oneToOne, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method createStringColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createStringColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateStringColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateStringColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + test('test method createTextColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createTextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); + test('test method updateTextColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateTextColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); - final response = await tablesDB.upsertRow( - databaseId: '', - tableId: '', - rowId: '', - ); - expect(response, isA()); + test('test method createUrlColumn()', () async { + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createUrlColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + ); + expect(response, isA()); + }); - }); + test('test method updateUrlColumn()', () async { + final Map data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateUrlColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: 'https://example.com', + ); + expect(response, isA()); + }); - test('test method updateRow()', () async { + test('test method createVarcharColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createVarcharColumn( + databaseId: '', + tableId: '', + key: '', + size: 1, + xrequired: true, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method updateVarcharColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateVarcharColumn( + databaseId: '', + tableId: '', + key: '', + xrequired: true, + xdefault: '', + ); + expect(response, isA()); + }); + test('test method getColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.getColumn( + databaseId: '', + tableId: '', + key: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method deleteColumn()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.updateRow( - databaseId: '', - tableId: '', - rowId: '', - ); - expect(response, isA()); + final response = await tablesDB.deleteColumn( + databaseId: '', + tableId: '', + key: '', + ); + }); - }); + test('test method updateRelationshipColumn()', () async { + final Map data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedTable': 'table', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateRelationshipColumn( + databaseId: '', + tableId: '', + key: '', + ); + expect(response, isA()); + }); - test('test method deleteRow()', () async { + test('test method listIndexes()', () async { + final Map data = { + 'total': 5, + 'indexes': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.listIndexes( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method createIndex()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'columns': [], + 'lengths': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createIndex( + databaseId: '', + tableId: '', + key: '', + type: enums.TablesDBIndexType.key, + columns: [], + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method getIndex()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'columns': [], + 'lengths': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.getIndex( + databaseId: '', + tableId: '', + key: '', + ); + expect(response, isA()); + }); + test('test method deleteIndex()', () async { + final data = ''; - final response = await tablesDB.deleteRow( - databaseId: '', - tableId: '', - rowId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method decrementRowColumn()', () async { + final response = await tablesDB.deleteIndex( + databaseId: '', + tableId: '', + key: '', + ); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method listRows()', () async { + final Map data = { + 'total': 5, + 'rows': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.listRows( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); + test('test method createRow()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createRow( + databaseId: '', + tableId: '', + rowId: '', + data: {}, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method createRows()', () async { + final Map data = { + 'total': 5, + 'rows': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.createRows( + databaseId: '', + tableId: '', + rows: [], + ); + expect(response, isA()); + }); + test('test method upsertRows()', () async { + final Map data = { + 'total': 5, + 'rows': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.upsertRows( + databaseId: '', + tableId: '', + rows: [], + ); + expect(response, isA()); + }); - final response = await tablesDB.decrementRowColumn( - databaseId: '', - tableId: '', - rowId: '', - column: '', - ); - expect(response, isA()); + test('test method updateRows()', () async { + final Map data = { + 'total': 5, + 'rows': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateRows( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); - }); + test('test method deleteRows()', () async { + final Map data = { + 'total': 5, + 'rows': [], + }; + + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.deleteRows( + databaseId: '', + tableId: '', + ); + expect(response, isA()); + }); - test('test method incrementRowColumn()', () async { + test('test method getRow()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.getRow( + databaseId: '', + tableId: '', + rowId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; + test('test method upsertRow()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.upsertRow( + databaseId: '', + tableId: '', + rowId: '', + ); + expect(response, isA()); + }); + test('test method updateRow()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.updateRow( + databaseId: '', + tableId: '', + rowId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method deleteRow()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await tablesDB.incrementRowColumn( - databaseId: '', - tableId: '', - rowId: '', - column: '', - ); - expect(response, isA()); + final response = await tablesDB.deleteRow( + databaseId: '', + tableId: '', + rowId: '', + ); + }); - }); + test('test method decrementRowColumn()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.decrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + ); + expect(response, isA()); + }); + test('test method incrementRowColumn()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tablesDB.incrementRowColumn( + databaseId: '', + tableId: '', + rowId: '', + column: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/services/teams_test.dart b/test/services/teams_test.dart index 38db809f..c183f7cc 100644 --- a/test/services/teams_test.dart +++ b/test/services/teams_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,322 +37,284 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Teams test', () { - late MockClient client; - late Teams teams; + group('Teams test', () { + late MockClient client; + late Teams teams; - setUp(() { - client = MockClient(); - teams = Teams(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'teams': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.create( - teamId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.get( - teamId: '', - ); - expect(response, isA()); - - }); - - test('test method updateName()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.updateName( - teamId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.delete( - teamId: '', - ); - }); - - test('test method listMemberships()', () async { - - final Map data = { - 'total': 5, - 'memberships': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.listMemberships( - teamId: '', - ); - expect(response, isA()); - - }); - - test('test method createMembership()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.createMembership( - teamId: '', - roles: [], - ); - expect(response, isA()); - - }); - - test('test method getMembership()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.getMembership( - teamId: '', - membershipId: '', - ); - expect(response, isA()); - - }); - - test('test method updateMembership()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await teams.updateMembership( - teamId: '', - membershipId: '', - roles: [], - ); - expect(response, isA()); - - }); - - test('test method deleteMembership()', () async { - - final data = ''; + setUp(() { + client = MockClient(); + teams = Teams(client); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method list()', () async { + final Map data = { + 'total': 5, + 'teams': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await teams.deleteMembership( - teamId: '', - membershipId: '', - ); - }); + final response = await teams.list(); + expect(response, isA()); + }); - test('test method updateMembershipStatus()', () async { + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {}, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.create( + teamId: '', + name: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {}, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.get( + teamId: '', + ); + expect(response, isA()); + }); + test('test method updateName()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {}, + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.updateName( + teamId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method delete()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await teams.updateMembershipStatus( - teamId: '', - membershipId: '', - userId: '', - secret: '', - ); - expect(response, isA()); + final response = await teams.delete( + teamId: '', + ); + }); - }); + test('test method listMemberships()', () async { + final Map data = { + 'total': 5, + 'memberships': [], + }; - test('test method getPrefs()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = {}; + final response = await teams.listMemberships( + teamId: '', + ); + expect(response, isA()); + }); + test('test method createMembership()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [], + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.createMembership( + teamId: '', + roles: [], + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method getMembership()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.getMembership( + teamId: '', + membershipId: '', + ); + expect(response, isA()); + }); + test('test method updateMembership()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.updateMembership( + teamId: '', + membershipId: '', + roles: [], + ); + expect(response, isA()); + }); - final response = await teams.getPrefs( - teamId: '', - ); - expect(response, isA()); + test('test method deleteMembership()', () async { + final data = ''; - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - test('test method updatePrefs()', () async { + final response = await teams.deleteMembership( + teamId: '', + membershipId: '', + ); + }); - final Map data = {}; + test('test method updateMembershipStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [], + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await teams.updateMembershipStatus( + teamId: '', + membershipId: '', + userId: '', + secret: '', + ); + expect(response, isA()); + }); + test('test method getPrefs()', () async { + final Map data = {}; - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await teams.getPrefs( + teamId: '', + ); + expect(response, isA()); + }); - final response = await teams.updatePrefs( - teamId: '', - prefs: {}, - ); - expect(response, isA()); + test('test method updatePrefs()', () async { + final Map data = {}; - }); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + final response = await teams.updatePrefs( + teamId: '', + prefs: {}, + ); + expect(response, isA()); }); + }); } diff --git a/test/services/tokens_test.dart b/test/services/tokens_test.dart index 0e08fb4b..152d7b8a 100644 --- a/test/services/tokens_test.dart +++ b/test/services/tokens_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,126 +37,117 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Tokens test', () { - late MockClient client; - late Tokens tokens; + group('Tokens test', () { + late MockClient client; + late Tokens tokens; - setUp(() { - client = MockClient(); - tokens = Tokens(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'tokens': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tokens.list( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - - }); - - test('test method createFileToken()', () async { - - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tokens.createFileToken( - bucketId: '', - fileId: '', - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tokens.get( - tokenId: '', - ); - expect(response, isA()); - - }); - - test('test method update()', () async { - - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await tokens.update( - tokenId: '', - ); - expect(response, isA()); + setUp(() { + client = MockClient(); + tokens = Tokens(client); + }); - }); + test('test method list()', () async { + final Map data = { + 'total': 5, + 'tokens': [], + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tokens.list( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + }); - test('test method delete()', () async { + test('test method createFileToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tokens.createFileToken( + bucketId: '', + fileId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method get()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tokens.get( + tokenId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method update()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await tokens.update( + tokenId: '', + ); + expect(response, isA()); + }); + test('test method delete()', () async { + final data = ''; - final response = await tokens.delete( - tokenId: '', - ); - }); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await tokens.delete( + tokenId: '', + ); }); + }); } diff --git a/test/services/users_test.dart b/test/services/users_test.dart index 80b8102c..ee8e4e51 100644 --- a/test/services/users_test.dart +++ b/test/services/users_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,1278 +37,1137 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Users test', () { - late MockClient client; - late Users users; - - setUp(() { - client = MockClient(); - users = Users(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'users': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + group('Users test', () { + late MockClient client; + late Users users; + setUp(() { + client = MockClient(); + users = Users(client); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.create( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method createArgon2User()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createArgon2User( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method createBcryptUser()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createBcryptUser( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method listIdentities()', () async { - - final Map data = { - 'total': 5, - 'identities': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.listIdentities( - ); - expect(response, isA()); - - }); - - test('test method deleteIdentity()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.deleteIdentity( - identityId: '', - ); - }); - - test('test method createMD5User()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createMD5User( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method createPHPassUser()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createPHPassUser( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method createScryptUser()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createScryptUser( - userId: '', - email: 'email@example.com', - password: 'password', - passwordSalt: '', - passwordCpu: 1, - passwordMemory: 1, - passwordParallel: 1, - passwordLength: 1, - ); - expect(response, isA()); - - }); - - test('test method createScryptModifiedUser()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createScryptModifiedUser( - userId: '', - email: 'email@example.com', - password: 'password', - passwordSalt: '', - passwordSaltSeparator: '', - passwordSignerKey: '', - ); - expect(response, isA()); - - }); - - test('test method createSHAUser()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createSHAUser( - userId: '', - email: 'email@example.com', - password: 'password', - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.get( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.delete( - userId: '', - ); - }); - - test('test method updateEmail()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateEmail( - userId: '', - email: 'email@example.com', - ); - expect(response, isA()); - - }); - - test('test method updateImpersonator()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateImpersonator( - userId: '', - impersonator: true, - ); - expect(response, isA()); - - }); - - test('test method createJWT()', () async { - - final Map data = { - 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createJWT( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method updateLabels()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateLabels( - userId: '', - labels: [], - ); - expect(response, isA()); - - }); - - test('test method listLogs()', () async { - - final Map data = { - 'total': 5, - 'logs': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.listLogs( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method listMemberships()', () async { - - final Map data = { - 'total': 5, - 'memberships': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.listMemberships( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method updateMfa()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateMfa( - userId: '', - mfa: true, - ); - expect(response, isA()); - - }); - - test('test method updateMFA()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateMFA( - userId: '', - mfa: true, - ); - expect(response, isA()); - - }); - - test('test method deleteMfaAuthenticator()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.deleteMfaAuthenticator( - userId: '', - type: enums.AuthenticatorType.totp, - ); - }); - - test('test method deleteMFAAuthenticator()', () async { - - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.deleteMFAAuthenticator( - userId: '', - type: enums.AuthenticatorType.totp, - ); - }); - - test('test method listMfaFactors()', () async { - - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.listMfaFactors( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method listMFAFactors()', () async { - - final Map data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.listMFAFactors( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method getMfaRecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.getMfaRecoveryCodes( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method getMFARecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.getMFARecoveryCodes( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method updateMfaRecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateMfaRecoveryCodes( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method updateMFARecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateMFARecoveryCodes( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method createMfaRecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createMfaRecoveryCodes( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method createMFARecoveryCodes()', () async { - - final Map data = { - 'recoveryCodes': [],}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.createMFARecoveryCodes( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method updateName()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updateName( - userId: '', - name: '', - ); - expect(response, isA()); - - }); - - test('test method updatePassword()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updatePassword( - userId: '', - password: '', - ); - expect(response, isA()); - - }); - - test('test method updatePhone()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - - - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.updatePhone( - userId: '', - number: '+12065550100', - ); - expect(response, isA()); - - }); - - test('test method getPrefs()', () async { - - final Map data = {}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await users.getPrefs( - userId: '', - ); - expect(response, isA()); - - }); - - test('test method updatePrefs()', () async { + test('test method list()', () async { + final Map data = { + 'total': 5, + 'users': [], + }; - final Map data = {}; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.list(); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.create( + userId: '', + ); + expect(response, isA()); + }); + test('test method createArgon2User()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createArgon2User( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); - final response = await users.updatePrefs( - userId: '', - prefs: {}, - ); - expect(response, isA()); + test('test method createBcryptUser()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createBcryptUser( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); - }); + test('test method listIdentities()', () async { + final Map data = { + 'total': 5, + 'identities': [], + }; - test('test method listSessions()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - 'total': 5, - 'sessions': [],}; + final response = await users.listIdentities(); + expect(response, isA()); + }); + test('test method deleteIdentity()', () async { + final data = ''; - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.deleteIdentity( + identityId: '', + ); + }); - final response = await users.listSessions( - userId: '', - ); - expect(response, isA()); + test('test method createMD5User()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createMD5User( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); - }); + test('test method createPHPassUser()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createPHPassUser( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); - test('test method createSession()', () async { + test('test method createScryptUser()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createScryptUser( + userId: '', + email: 'email@example.com', + password: 'password', + passwordSalt: '', + passwordCpu: 1, + passwordMemory: 1, + passwordParallel: 1, + passwordLength: 1, + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + test('test method createScryptModifiedUser()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createScryptModifiedUser( + userId: '', + email: 'email@example.com', + password: 'password', + passwordSalt: '', + passwordSaltSeparator: '', + passwordSignerKey: '', + ); + expect(response, isA()); + }); + test('test method createSHAUser()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createSHAUser( + userId: '', + email: 'email@example.com', + password: 'password', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.get( + userId: '', + ); + expect(response, isA()); + }); + test('test method delete()', () async { + final data = ''; - final response = await users.createSession( - userId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await users.delete( + userId: '', + ); + }); - test('test method deleteSessions()', () async { + test('test method updateEmail()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateEmail( + userId: '', + email: 'email@example.com', + ); + expect(response, isA()); + }); - final data = ''; + test('test method updateImpersonator()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateImpersonator( + userId: '', + impersonator: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + test('test method createJWT()', () async { + final Map data = { + 'jwt': + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + }; + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.deleteSessions( - userId: '', - ); - }); + final response = await users.createJWT( + userId: '', + ); + expect(response, isA()); + }); - test('test method deleteSession()', () async { + test('test method updateLabels()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateLabels( + userId: '', + labels: [], + ); + expect(response, isA()); + }); - final data = ''; + test('test method listLogs()', () async { + final Map data = { + 'total': 5, + 'logs': [], + }; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.listLogs( + userId: '', + ); + expect(response, isA()); + }); - final response = await users.deleteSession( - userId: '', - sessionId: '', - ); - }); + test('test method listMemberships()', () async { + final Map data = { + 'total': 5, + 'memberships': [], + }; - test('test method updateStatus()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + final response = await users.listMemberships( + userId: '', + ); + expect(response, isA()); + }); + test('test method updateMfa()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateMfa( + userId: '', + mfa: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method updateMFA()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateMFA( + userId: '', + mfa: true, + ); + expect(response, isA()); + }); + test('test method deleteMfaAuthenticator()', () async { + final data = ''; - final response = await users.updateStatus( - userId: '', - status: true, - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await users.deleteMfaAuthenticator( + userId: '', + type: enums.AuthenticatorType.totp, + ); + }); - test('test method listTargets()', () async { + test('test method deleteMFAAuthenticator()', () async { + final data = ''; - final Map data = { - 'total': 5, - 'targets': [],}; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.deleteMFAAuthenticator( + userId: '', + type: enums.AuthenticatorType.totp, + ); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method listMfaFactors()', () async { + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.listMfaFactors( + userId: '', + ); + expect(response, isA()); + }); + test('test method listMFAFactors()', () async { + final Map data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.listMFAFactors( + userId: '', + ); + expect(response, isA()); + }); - final response = await users.listTargets( - userId: '', - ); - expect(response, isA()); + test('test method getMfaRecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method createTarget()', () async { + final response = await users.getMfaRecoveryCodes( + userId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; + test('test method getMFARecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + final response = await users.getMFARecoveryCodes( + userId: '', + ); + expect(response, isA()); + }); + test('test method updateMfaRecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - final response = await users.createTarget( - userId: '', - targetId: '', - providerType: enums.MessagingProviderType.email, - identifier: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await users.updateMfaRecoveryCodes( + userId: '', + ); + expect(response, isA()); + }); - test('test method getTarget()', () async { + test('test method updateMFARecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.updateMFARecoveryCodes( + userId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); + test('test method createMfaRecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.getTarget( - userId: '', - targetId: '', - ); - expect(response, isA()); + final response = await users.createMfaRecoveryCodes( + userId: '', + ); + expect(response, isA()); + }); - }); + test('test method createMFARecoveryCodes()', () async { + final Map data = { + 'recoveryCodes': [], + }; - test('test method updateTarget()', () async { + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; + final response = await users.createMFARecoveryCodes( + userId: '', + ); + expect(response, isA()); + }); + test('test method updateName()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateName( + userId: '', + name: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method updatePassword()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updatePassword( + userId: '', + password: '', + ); + expect(response, isA()); + }); + test('test method updatePhone()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updatePhone( + userId: '', + number: '+12065550100', + ); + expect(response, isA()); + }); - final response = await users.updateTarget( - userId: '', - targetId: '', - ); - expect(response, isA()); + test('test method getPrefs()', () async { + final Map data = {}; - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method deleteTarget()', () async { + final response = await users.getPrefs( + userId: '', + ); + expect(response, isA()); + }); - final data = ''; + test('test method updatePrefs()', () async { + final Map data = {}; - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.updatePrefs( + userId: '', + prefs: {}, + ); + expect(response, isA()); + }); - final response = await users.deleteTarget( - userId: '', - targetId: '', - ); - }); + test('test method listSessions()', () async { + final Map data = { + 'total': 5, + 'sessions': [], + }; - test('test method createToken()', () async { + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; + final response = await users.listSessions( + userId: '', + ); + expect(response, isA()); + }); + test('test method createSession()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createSession( + userId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); + test('test method deleteSessions()', () async { + final data = ''; + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.createToken( - userId: '', - ); - expect(response, isA()); + final response = await users.deleteSessions( + userId: '', + ); + }); - }); + test('test method deleteSession()', () async { + final data = ''; - test('test method updateEmailVerification()', () async { + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + final response = await users.deleteSession( + userId: '', + sessionId: '', + ); + }); + test('test method updateStatus()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateStatus( + userId: '', + status: true, + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method listTargets()', () async { + final Map data = { + 'total': 5, + 'targets': [], + }; + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - final response = await users.updateEmailVerification( - userId: '', - emailVerification: true, - ); - expect(response, isA()); + final response = await users.listTargets( + userId: '', + ); + expect(response, isA()); + }); - }); + test('test method createTarget()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createTarget( + userId: '', + targetId: '', + providerType: enums.MessagingProviderType.email, + identifier: '', + ); + expect(response, isA()); + }); - test('test method updatePhoneVerification()', () async { + test('test method getTarget()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.getTarget( + userId: '', + targetId: '', + ); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + test('test method updateTarget()', () async { + final Map data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateTarget( + userId: '', + targetId: '', + ); + expect(response, isA()); + }); + test('test method deleteTarget()', () async { + final data = ''; - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); + final response = await users.deleteTarget( + userId: '', + targetId: '', + ); + }); - final response = await users.updatePhoneVerification( - userId: '', - phoneVerification: true, - ); - expect(response, isA()); + test('test method createToken()', () async { + final Map data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox', + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.createToken( + userId: '', + ); + expect(response, isA()); + }); - }); + test('test method updateEmailVerification()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updateEmailVerification( + userId: '', + emailVerification: true, + ); + expect(response, isA()); + }); + test('test method updatePhoneVerification()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await users.updatePhoneVerification( + userId: '', + phoneVerification: true, + ); + expect(response, isA()); }); + }); } diff --git a/test/services/webhooks_test.dart b/test/services/webhooks_test.dart index 0184851b..58a633e0 100644 --- a/test/services/webhooks_test.dart +++ b/test/services/webhooks_test.dart @@ -24,7 +24,8 @@ class MockClient extends Mock implements Client { @override Future webAuth(Uri url) async { - return super.noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); + return super + .noSuchMethod(Invocation.method(#webAuth, [url]), returnValue: 'done'); } @override @@ -36,177 +37,161 @@ class MockClient extends Mock implements Client { Map? headers, Function(UploadProgress)? onProgress, }) async { - return super.noSuchMethod(Invocation.method(#chunkedUpload, [path, params, paramName, idParamName, headers]), returnValue: Response(data: {})); + return super.noSuchMethod( + Invocation.method( + #chunkedUpload, [path, params, paramName, idParamName, headers]), + returnValue: Response(data: {})); } } void main() { - group('Webhooks test', () { - late MockClient client; - late Webhooks webhooks; - - setUp(() { - client = MockClient(); - webhooks = Webhooks(client); - }); - - test('test method list()', () async { - - final Map data = { - 'total': 5, - 'webhooks': [],}; + group('Webhooks test', () { + late MockClient client; + late Webhooks webhooks; + setUp(() { + client = MockClient(); + webhooks = Webhooks(client); + }); - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await webhooks.list( - ); - expect(response, isA()); - - }); - - test('test method create()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - - - when(client.call( - HttpMethod.post, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await webhooks.create( - webhookId: '', - url: '', - name: '', - events: [], - ); - expect(response, isA()); - - }); - - test('test method get()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - - - when(client.call( - HttpMethod.get, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await webhooks.get( - webhookId: '', - ); - expect(response, isA()); - - }); - - test('test method update()', () async { - - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - - - when(client.call( - HttpMethod.put, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await webhooks.update( - webhookId: '', - name: '', - url: '', - events: [], - ); - expect(response, isA()); - - }); - - test('test method delete()', () async { + test('test method list()', () async { + final Map data = { + 'total': 5, + 'webhooks': [], + }; - final data = ''; - - when(client.call( - HttpMethod.delete, - )).thenAnswer((_) async => Response(data: data)); - - - final response = await webhooks.delete( - webhookId: '', - ); - }); + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); - test('test method updateSecret()', () async { + final response = await webhooks.list(); + expect(response, isA()); + }); - final Map data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; + test('test method create()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10, + }; + + when(client.call( + HttpMethod.post, + )).thenAnswer((_) async => Response(data: data)); + + final response = await webhooks.create( + webhookId: '', + url: '', + name: '', + events: [], + ); + expect(response, isA()); + }); + test('test method get()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10, + }; + + when(client.call( + HttpMethod.get, + )).thenAnswer((_) async => Response(data: data)); + + final response = await webhooks.get( + webhookId: '', + ); + expect(response, isA()); + }); - when(client.call( - HttpMethod.patch, - )).thenAnswer((_) async => Response(data: data)); + test('test method update()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10, + }; + + when(client.call( + HttpMethod.put, + )).thenAnswer((_) async => Response(data: data)); + + final response = await webhooks.update( + webhookId: '', + name: '', + url: '', + events: [], + ); + expect(response, isA()); + }); + test('test method delete()', () async { + final data = ''; - final response = await webhooks.updateSecret( - webhookId: '', - ); - expect(response, isA()); + when(client.call( + HttpMethod.delete, + )).thenAnswer((_) async => Response(data: data)); - }); + final response = await webhooks.delete( + webhookId: '', + ); + }); + test('test method updateSecret()', () async { + final Map data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10, + }; + + when(client.call( + HttpMethod.patch, + )).thenAnswer((_) async => Response(data: data)); + + final response = await webhooks.updateSecret( + webhookId: '', + ); + expect(response, isA()); }); + }); } diff --git a/test/src/models/activity_event_list_test.dart b/test/src/models/activity_event_list_test.dart index dea30a98..fa2c4646 100644 --- a/test/src/models/activity_event_list_test.dart +++ b/test/src/models/activity_event_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ActivityEventList.fromMap(map); - expect(result.total, 5); - expect(result.events, []); - }); + expect(result.total, 5); + expect(result.events, []); + }); }); } diff --git a/test/src/models/activity_event_test.dart b/test/src/models/activity_event_test.dart index 81ef69f5..3db2598a 100644 --- a/test/src/models/activity_event_test.dart +++ b/test/src/models/activity_event_test.dart @@ -15,7 +15,8 @@ void main() { resourceId: '610fc2f985ee0', resource: 'collections/610fc2f985ee0', event: 'account.sessions.create', - userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', ip: '127.0.0.1', mode: 'admin', country: 'US', @@ -42,38 +43,39 @@ void main() { final map = model.toMap(); final result = ActivityEvent.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.userType, 'user'); - expect(result.userId, '610fc2f985ee0'); - expect(result.userEmail, 'john@appwrite.io'); - expect(result.userName, 'John Doe'); - expect(result.resourceParent, 'database/ID'); - expect(result.resourceType, 'collection'); - expect(result.resourceId, '610fc2f985ee0'); - expect(result.resource, 'collections/610fc2f985ee0'); - expect(result.event, 'account.sessions.create'); - expect(result.userAgent, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); - expect(result.ip, '127.0.0.1'); - expect(result.mode, 'admin'); - expect(result.country, 'US'); - expect(result.time, '2020-10-15T06:38:00.000+00:00'); - expect(result.projectId, '610fc2f985ee0'); - expect(result.teamId, '610fc2f985ee0'); - expect(result.hostname, 'appwrite.io'); - expect(result.osCode, 'Mac'); - expect(result.osName, 'Mac'); - expect(result.osVersion, 'Mac'); - expect(result.clientType, 'browser'); - expect(result.clientCode, 'CM'); - expect(result.clientName, 'Chrome Mobile iOS'); - expect(result.clientVersion, '84.0'); - expect(result.clientEngine, 'WebKit'); - expect(result.clientEngineVersion, '605.1.15'); - expect(result.deviceName, 'smartphone'); - expect(result.deviceBrand, 'Google'); - expect(result.deviceModel, 'Nexus 5'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.userType, 'user'); + expect(result.userId, '610fc2f985ee0'); + expect(result.userEmail, 'john@appwrite.io'); + expect(result.userName, 'John Doe'); + expect(result.resourceParent, 'database/ID'); + expect(result.resourceType, 'collection'); + expect(result.resourceId, '610fc2f985ee0'); + expect(result.resource, 'collections/610fc2f985ee0'); + expect(result.event, 'account.sessions.create'); + expect(result.userAgent, + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'); + expect(result.ip, '127.0.0.1'); + expect(result.mode, 'admin'); + expect(result.country, 'US'); + expect(result.time, '2020-10-15T06:38:00.000+00:00'); + expect(result.projectId, '610fc2f985ee0'); + expect(result.teamId, '610fc2f985ee0'); + expect(result.hostname, 'appwrite.io'); + expect(result.osCode, 'Mac'); + expect(result.osName, 'Mac'); + expect(result.osVersion, 'Mac'); + expect(result.clientType, 'browser'); + expect(result.clientCode, 'CM'); + expect(result.clientName, 'Chrome Mobile iOS'); + expect(result.clientVersion, '84.0'); + expect(result.clientEngine, 'WebKit'); + expect(result.clientEngineVersion, '605.1.15'); + expect(result.deviceName, 'smartphone'); + expect(result.deviceBrand, 'Google'); + expect(result.deviceModel, 'Nexus 5'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + }); }); } diff --git a/test/src/models/algo_argon2_test.dart b/test/src/models/algo_argon2_test.dart index 8e579a4a..d55be87a 100644 --- a/test/src/models/algo_argon2_test.dart +++ b/test/src/models/algo_argon2_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = AlgoArgon2.fromMap(map); - expect(result.type, 'argon2'); - expect(result.memoryCost, 65536); - expect(result.timeCost, 4); - expect(result.threads, 3); - }); + expect(result.type, 'argon2'); + expect(result.memoryCost, 65536); + expect(result.timeCost, 4); + expect(result.threads, 3); + }); }); } diff --git a/test/src/models/algo_bcrypt_test.dart b/test/src/models/algo_bcrypt_test.dart index 9d9117ac..3046b077 100644 --- a/test/src/models/algo_bcrypt_test.dart +++ b/test/src/models/algo_bcrypt_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoBcrypt.fromMap(map); - expect(result.type, 'bcrypt'); - }); + expect(result.type, 'bcrypt'); + }); }); } diff --git a/test/src/models/algo_md5_test.dart b/test/src/models/algo_md5_test.dart index a8074312..01bb0836 100644 --- a/test/src/models/algo_md5_test.dart +++ b/test/src/models/algo_md5_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoMd5.fromMap(map); - expect(result.type, 'md5'); - }); + expect(result.type, 'md5'); + }); }); } diff --git a/test/src/models/algo_phpass_test.dart b/test/src/models/algo_phpass_test.dart index 414d5658..50c43860 100644 --- a/test/src/models/algo_phpass_test.dart +++ b/test/src/models/algo_phpass_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoPhpass.fromMap(map); - expect(result.type, 'phpass'); - }); + expect(result.type, 'phpass'); + }); }); } diff --git a/test/src/models/algo_scrypt_modified_test.dart b/test/src/models/algo_scrypt_modified_test.dart index 53596100..4d1dda53 100644 --- a/test/src/models/algo_scrypt_modified_test.dart +++ b/test/src/models/algo_scrypt_modified_test.dart @@ -8,16 +8,18 @@ void main() { type: 'scryptMod', salt: 'UxLMreBr6tYyjQ==', saltSeparator: 'Bw==', - signerKey: 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ==', + signerKey: + 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ==', ); final map = model.toMap(); final result = AlgoScryptModified.fromMap(map); - expect(result.type, 'scryptMod'); - expect(result.salt, 'UxLMreBr6tYyjQ=='); - expect(result.saltSeparator, 'Bw=='); - expect(result.signerKey, 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ=='); - }); + expect(result.type, 'scryptMod'); + expect(result.salt, 'UxLMreBr6tYyjQ=='); + expect(result.saltSeparator, 'Bw=='); + expect(result.signerKey, + 'XyEKE9RcTDeLEsL/RjwPDBv/RqDl8fb3gpYEOQaPihbxf1ZAtSOHCjuAAa7Q3oHpCYhXSN9tizHgVOwn6krflQ=='); + }); }); } diff --git a/test/src/models/algo_scrypt_test.dart b/test/src/models/algo_scrypt_test.dart index ead39885..aa3128c5 100644 --- a/test/src/models/algo_scrypt_test.dart +++ b/test/src/models/algo_scrypt_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = AlgoScrypt.fromMap(map); - expect(result.type, 'scrypt'); - expect(result.costCpu, 8); - expect(result.costMemory, 14); - expect(result.costParallel, 1); - expect(result.length, 64); - }); + expect(result.type, 'scrypt'); + expect(result.costCpu, 8); + expect(result.costMemory, 14); + expect(result.costParallel, 1); + expect(result.length, 64); + }); }); } diff --git a/test/src/models/algo_sha_test.dart b/test/src/models/algo_sha_test.dart index ff27754e..ea1ec869 100644 --- a/test/src/models/algo_sha_test.dart +++ b/test/src/models/algo_sha_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = AlgoSha.fromMap(map); - expect(result.type, 'sha'); - }); + expect(result.type, 'sha'); + }); }); } diff --git a/test/src/models/attribute_bigint_test.dart b/test/src/models/attribute_bigint_test.dart index 1cce6f25..c56c8ddb 100644 --- a/test/src/models/attribute_bigint_test.dart +++ b/test/src/models/attribute_bigint_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeBigint.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'bigint'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'count'); + expect(result.type, 'bigint'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_boolean_test.dart b/test/src/models/attribute_boolean_test.dart index 4e1ebb05..61595d2b 100644 --- a/test/src/models/attribute_boolean_test.dart +++ b/test/src/models/attribute_boolean_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeBoolean.fromMap(map); - expect(result.key, 'isEnabled'); - expect(result.type, 'boolean'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'isEnabled'); + expect(result.type, 'boolean'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_datetime_test.dart b/test/src/models/attribute_datetime_test.dart index 5ae8fa00..d2e3aa2e 100644 --- a/test/src/models/attribute_datetime_test.dart +++ b/test/src/models/attribute_datetime_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeDatetime.fromMap(map); - expect(result.key, 'birthDay'); - expect(result.type, 'datetime'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'datetime'); - }); + expect(result.key, 'birthDay'); + expect(result.type, 'datetime'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'datetime'); + }); }); } diff --git a/test/src/models/attribute_email_test.dart b/test/src/models/attribute_email_test.dart index 5d8ecea7..82b70b38 100644 --- a/test/src/models/attribute_email_test.dart +++ b/test/src/models/attribute_email_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeEmail.fromMap(map); - expect(result.key, 'userEmail'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'email'); - }); + expect(result.key, 'userEmail'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'email'); + }); }); } diff --git a/test/src/models/attribute_enum_test.dart b/test/src/models/attribute_enum_test.dart index 5bffd427..2df66e1a 100644 --- a/test/src/models/attribute_enum_test.dart +++ b/test/src/models/attribute_enum_test.dart @@ -20,15 +20,15 @@ void main() { final map = model.toMap(); final result = AttributeEnum.fromMap(map); - expect(result.key, 'status'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.elements, []); - expect(result.format, 'enum'); - }); + expect(result.key, 'status'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.elements, []); + expect(result.format, 'enum'); + }); }); } diff --git a/test/src/models/attribute_float_test.dart b/test/src/models/attribute_float_test.dart index ade52316..c935ab38 100644 --- a/test/src/models/attribute_float_test.dart +++ b/test/src/models/attribute_float_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeFloat.fromMap(map); - expect(result.key, 'percentageCompleted'); - expect(result.type, 'double'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'percentageCompleted'); + expect(result.type, 'double'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_integer_test.dart b/test/src/models/attribute_integer_test.dart index c5241be4..1c507a7d 100644 --- a/test/src/models/attribute_integer_test.dart +++ b/test/src/models/attribute_integer_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeInteger.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'integer'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'count'); + expect(result.type, 'integer'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_ip_test.dart b/test/src/models/attribute_ip_test.dart index 9b808863..c1cd14bb 100644 --- a/test/src/models/attribute_ip_test.dart +++ b/test/src/models/attribute_ip_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeIp.fromMap(map); - expect(result.key, 'ipAddress'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'ip'); - }); + expect(result.key, 'ipAddress'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'ip'); + }); }); } diff --git a/test/src/models/attribute_line_test.dart b/test/src/models/attribute_line_test.dart index c1924a5d..a51422e2 100644 --- a/test/src/models/attribute_line_test.dart +++ b/test/src/models/attribute_line_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeLine.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_list_test.dart b/test/src/models/attribute_list_test.dart index 3b2384ff..93e033ee 100644 --- a/test/src/models/attribute_list_test.dart +++ b/test/src/models/attribute_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = AttributeList.fromMap(map); - expect(result.total, 5); - expect(result.attributes, []); - }); + expect(result.total, 5); + expect(result.attributes, []); + }); }); } diff --git a/test/src/models/attribute_longtext_test.dart b/test/src/models/attribute_longtext_test.dart index 794ab5dc..4f58177f 100644 --- a/test/src/models/attribute_longtext_test.dart +++ b/test/src/models/attribute_longtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeLongtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_mediumtext_test.dart b/test/src/models/attribute_mediumtext_test.dart index 5bc9e400..53722e21 100644 --- a/test/src/models/attribute_mediumtext_test.dart +++ b/test/src/models/attribute_mediumtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeMediumtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_point_test.dart b/test/src/models/attribute_point_test.dart index 2f90d374..fe3d52ac 100644 --- a/test/src/models/attribute_point_test.dart +++ b/test/src/models/attribute_point_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributePoint.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_polygon_test.dart b/test/src/models/attribute_polygon_test.dart index a4b452d1..5c5df821 100644 --- a/test/src/models/attribute_polygon_test.dart +++ b/test/src/models/attribute_polygon_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributePolygon.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_relationship_test.dart b/test/src/models/attribute_relationship_test.dart index 2bccd34c..8776dffc 100644 --- a/test/src/models/attribute_relationship_test.dart +++ b/test/src/models/attribute_relationship_test.dart @@ -24,19 +24,19 @@ void main() { final map = model.toMap(); final result = AttributeRelationship.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.relatedCollection, 'collection'); - expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); - expect(result.twoWay, true); - expect(result.twoWayKey, 'string'); - expect(result.onDelete, 'restrict|cascade|setNull'); - expect(result.side, 'parent|child'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.relatedCollection, 'collection'); + expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); + expect(result.twoWay, true); + expect(result.twoWayKey, 'string'); + expect(result.onDelete, 'restrict|cascade|setNull'); + expect(result.side, 'parent|child'); + }); }); } diff --git a/test/src/models/attribute_string_test.dart b/test/src/models/attribute_string_test.dart index 8f92eb26..56f9e29e 100644 --- a/test/src/models/attribute_string_test.dart +++ b/test/src/models/attribute_string_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeString.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/attribute_text_test.dart b/test/src/models/attribute_text_test.dart index 96d57a55..b8fe6afc 100644 --- a/test/src/models/attribute_text_test.dart +++ b/test/src/models/attribute_text_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = AttributeText.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/attribute_url_test.dart b/test/src/models/attribute_url_test.dart index cc751748..24d4c99d 100644 --- a/test/src/models/attribute_url_test.dart +++ b/test/src/models/attribute_url_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeUrl.fromMap(map); - expect(result.key, 'githubUrl'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'url'); - }); + expect(result.key, 'githubUrl'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'url'); + }); }); } diff --git a/test/src/models/attribute_varchar_test.dart b/test/src/models/attribute_varchar_test.dart index 536b42a5..b0c175d8 100644 --- a/test/src/models/attribute_varchar_test.dart +++ b/test/src/models/attribute_varchar_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = AttributeVarchar.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, AttributeStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, AttributeStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/auth_provider_test.dart b/test/src/models/auth_provider_test.dart index e1c237f8..6031ccea 100644 --- a/test/src/models/auth_provider_test.dart +++ b/test/src/models/auth_provider_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = AuthProvider.fromMap(map); - expect(result.key, 'github'); - expect(result.name, 'GitHub'); - expect(result.appId, '259125845563242502'); - expect(result.secret, ''); - expect(result.enabled, true); - }); + expect(result.key, 'github'); + expect(result.name, 'GitHub'); + expect(result.appId, '259125845563242502'); + expect(result.secret, ''); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/backup_archive_list_test.dart b/test/src/models/backup_archive_list_test.dart index 8f1e4edb..39f02daf 100644 --- a/test/src/models/backup_archive_list_test.dart +++ b/test/src/models/backup_archive_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BackupArchiveList.fromMap(map); - expect(result.total, 5); - expect(result.archives, []); - }); + expect(result.total, 5); + expect(result.archives, []); + }); }); } diff --git a/test/src/models/backup_archive_test.dart b/test/src/models/backup_archive_test.dart index 1d8d9b85..ddea414d 100644 --- a/test/src/models/backup_archive_test.dart +++ b/test/src/models/backup_archive_test.dart @@ -20,16 +20,16 @@ void main() { final map = model.toMap(); final result = BackupArchive.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.policyId, 'did8jx6ws45jana098ab7'); - expect(result.size, 100000); - expect(result.status, 'completed'); - expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.migrationId, 'did8jx6ws45jana098ab7'); - expect(result.services, []); - expect(result.resources, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.policyId, 'did8jx6ws45jana098ab7'); + expect(result.size, 100000); + expect(result.status, 'completed'); + expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.migrationId, 'did8jx6ws45jana098ab7'); + expect(result.services, []); + expect(result.resources, []); + }); }); } diff --git a/test/src/models/backup_policy_list_test.dart b/test/src/models/backup_policy_list_test.dart index 97c13eba..c489e802 100644 --- a/test/src/models/backup_policy_list_test.dart +++ b/test/src/models/backup_policy_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BackupPolicyList.fromMap(map); - expect(result.total, 5); - expect(result.policies, []); - }); + expect(result.total, 5); + expect(result.policies, []); + }); }); } diff --git a/test/src/models/backup_policy_test.dart b/test/src/models/backup_policy_test.dart index 554eacb7..8f0731c1 100644 --- a/test/src/models/backup_policy_test.dart +++ b/test/src/models/backup_policy_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = BackupPolicy.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.name, 'Hourly backups'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.services, []); - expect(result.resources, []); - expect(result.retention, 7); - expect(result.schedule, '0 * * * *'); - expect(result.enabled, true); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.name, 'Hourly backups'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.services, []); + expect(result.resources, []); + expect(result.retention, 7); + expect(result.schedule, '0 * * * *'); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/backup_restoration_list_test.dart b/test/src/models/backup_restoration_list_test.dart index 8168498e..2b356a16 100644 --- a/test/src/models/backup_restoration_list_test.dart +++ b/test/src/models/backup_restoration_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BackupRestorationList.fromMap(map); - expect(result.total, 5); - expect(result.restorations, []); - }); + expect(result.total, 5); + expect(result.restorations, []); + }); }); } diff --git a/test/src/models/backup_restoration_test.dart b/test/src/models/backup_restoration_test.dart index 9012bb33..b3b6f316 100644 --- a/test/src/models/backup_restoration_test.dart +++ b/test/src/models/backup_restoration_test.dart @@ -21,17 +21,17 @@ void main() { final map = model.toMap(); final result = BackupRestoration.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.archiveId, 'did8jx6ws45jana098ab7'); - expect(result.policyId, 'did8jx6ws45jana098ab7'); - expect(result.status, 'completed'); - expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.migrationId, 'did8jx6ws45jana098ab7'); - expect(result.services, []); - expect(result.resources, []); - expect(result.options, '{databases.database[{oldId, newId, newName}]}'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.archiveId, 'did8jx6ws45jana098ab7'); + expect(result.policyId, 'did8jx6ws45jana098ab7'); + expect(result.status, 'completed'); + expect(result.startedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.migrationId, 'did8jx6ws45jana098ab7'); + expect(result.services, []); + expect(result.resources, []); + expect(result.options, '{databases.database[{oldId, newId, newName}]}'); + }); }); } diff --git a/test/src/models/billing_limits_test.dart b/test/src/models/billing_limits_test.dart index 2bcbdb01..3ca637d1 100644 --- a/test/src/models/billing_limits_test.dart +++ b/test/src/models/billing_limits_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = BillingLimits.fromMap(map); - expect(result.bandwidth, 5); - expect(result.storage, 150); - expect(result.users, 200000); - expect(result.executions, 750000); - expect(result.GBHours, 100); - expect(result.imageTransformations, 100); - expect(result.authPhone, 10); - expect(result.budgetLimit, 100); - }); + expect(result.bandwidth, 5); + expect(result.storage, 150); + expect(result.users, 200000); + expect(result.executions, 750000); + expect(result.GBHours, 100); + expect(result.imageTransformations, 100); + expect(result.authPhone, 10); + expect(result.budgetLimit, 100); + }); }); } diff --git a/test/src/models/block_test.dart b/test/src/models/block_test.dart index fa9f3a24..7543c078 100644 --- a/test/src/models/block_test.dart +++ b/test/src/models/block_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Block.fromMap(map); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.resourceType, 'project'); - expect(result.resourceId, '5e5ea5c16897e'); - expect(result.projectName, 'My Project'); - expect(result.region, 'fra'); - expect(result.organizationName, 'Acme Inc.'); - expect(result.organizationId, '5e5ea5c16897e'); - expect(result.billingPlan, 'pro'); - }); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.resourceType, 'project'); + expect(result.resourceId, '5e5ea5c16897e'); + expect(result.projectName, 'My Project'); + expect(result.region, 'fra'); + expect(result.organizationName, 'Acme Inc.'); + expect(result.organizationId, '5e5ea5c16897e'); + expect(result.billingPlan, 'pro'); + }); }); } diff --git a/test/src/models/bucket_list_test.dart b/test/src/models/bucket_list_test.dart index b1200cb6..bb1ae4c6 100644 --- a/test/src/models/bucket_list_test.dart +++ b/test/src/models/bucket_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = BucketList.fromMap(map); - expect(result.total, 5); - expect(result.buckets, []); - }); + expect(result.total, 5); + expect(result.buckets, []); + }); }); } diff --git a/test/src/models/bucket_test.dart b/test/src/models/bucket_test.dart index 766ed86d..b1448177 100644 --- a/test/src/models/bucket_test.dart +++ b/test/src/models/bucket_test.dart @@ -24,20 +24,20 @@ void main() { final map = model.toMap(); final result = Bucket.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.fileSecurity, true); - expect(result.name, 'Documents'); - expect(result.enabled, true); - expect(result.maximumFileSize, 100); - expect(result.allowedFileExtensions, []); - expect(result.compression, 'gzip'); - expect(result.encryption, true); - expect(result.antivirus, true); - expect(result.transformations, true); - expect(result.totalSize, 128); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.fileSecurity, true); + expect(result.name, 'Documents'); + expect(result.enabled, true); + expect(result.maximumFileSize, 100); + expect(result.allowedFileExtensions, []); + expect(result.compression, 'gzip'); + expect(result.encryption, true); + expect(result.antivirus, true); + expect(result.transformations, true); + expect(result.totalSize, 128); + }); }); } diff --git a/test/src/models/collection_list_test.dart b/test/src/models/collection_list_test.dart index 4ba89d51..ef952c70 100644 --- a/test/src/models/collection_list_test.dart +++ b/test/src/models/collection_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = CollectionList.fromMap(map); - expect(result.total, 5); - expect(result.collections, []); - }); + expect(result.total, 5); + expect(result.collections, []); + }); }); } diff --git a/test/src/models/collection_test.dart b/test/src/models/collection_test.dart index 87c53498..f41cd169 100644 --- a/test/src/models/collection_test.dart +++ b/test/src/models/collection_test.dart @@ -22,18 +22,18 @@ void main() { final map = model.toMap(); final result = Collection.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.databaseId, '5e5ea5c16897e'); - expect(result.name, 'My Collection'); - expect(result.enabled, true); - expect(result.documentSecurity, true); - expect(result.attributes, []); - expect(result.indexes, []); - expect(result.bytesMax, 65535); - expect(result.bytesUsed, 1500); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.databaseId, '5e5ea5c16897e'); + expect(result.name, 'My Collection'); + expect(result.enabled, true); + expect(result.documentSecurity, true); + expect(result.attributes, []); + expect(result.indexes, []); + expect(result.bytesMax, 65535); + expect(result.bytesUsed, 1500); + }); }); } diff --git a/test/src/models/column_bigint_test.dart b/test/src/models/column_bigint_test.dart index fa5cec4a..1cd181b3 100644 --- a/test/src/models/column_bigint_test.dart +++ b/test/src/models/column_bigint_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnBigint.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'bigint'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'count'); + expect(result.type, 'bigint'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_boolean_test.dart b/test/src/models/column_boolean_test.dart index c0c52eaf..cd128d10 100644 --- a/test/src/models/column_boolean_test.dart +++ b/test/src/models/column_boolean_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnBoolean.fromMap(map); - expect(result.key, 'isEnabled'); - expect(result.type, 'boolean'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'isEnabled'); + expect(result.type, 'boolean'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_datetime_test.dart b/test/src/models/column_datetime_test.dart index 5f8995b0..109c16c3 100644 --- a/test/src/models/column_datetime_test.dart +++ b/test/src/models/column_datetime_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnDatetime.fromMap(map); - expect(result.key, 'birthDay'); - expect(result.type, 'datetime'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'datetime'); - }); + expect(result.key, 'birthDay'); + expect(result.type, 'datetime'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'datetime'); + }); }); } diff --git a/test/src/models/column_email_test.dart b/test/src/models/column_email_test.dart index 9047dc81..9bc520be 100644 --- a/test/src/models/column_email_test.dart +++ b/test/src/models/column_email_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnEmail.fromMap(map); - expect(result.key, 'userEmail'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'email'); - }); + expect(result.key, 'userEmail'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'email'); + }); }); } diff --git a/test/src/models/column_enum_test.dart b/test/src/models/column_enum_test.dart index b27fa78a..2a229ba0 100644 --- a/test/src/models/column_enum_test.dart +++ b/test/src/models/column_enum_test.dart @@ -20,15 +20,15 @@ void main() { final map = model.toMap(); final result = ColumnEnum.fromMap(map); - expect(result.key, 'status'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.elements, []); - expect(result.format, 'enum'); - }); + expect(result.key, 'status'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.elements, []); + expect(result.format, 'enum'); + }); }); } diff --git a/test/src/models/column_float_test.dart b/test/src/models/column_float_test.dart index 5d8fc98f..e2503b06 100644 --- a/test/src/models/column_float_test.dart +++ b/test/src/models/column_float_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnFloat.fromMap(map); - expect(result.key, 'percentageCompleted'); - expect(result.type, 'double'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'percentageCompleted'); + expect(result.type, 'double'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_index_list_test.dart b/test/src/models/column_index_list_test.dart index 571793aa..aae59124 100644 --- a/test/src/models/column_index_list_test.dart +++ b/test/src/models/column_index_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ColumnIndexList.fromMap(map); - expect(result.total, 5); - expect(result.indexes, []); - }); + expect(result.total, 5); + expect(result.indexes, []); + }); }); } diff --git a/test/src/models/column_index_test.dart b/test/src/models/column_index_test.dart index daa40c71..8277048d 100644 --- a/test/src/models/column_index_test.dart +++ b/test/src/models/column_index_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = ColumnIndex.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.key, 'index1'); - expect(result.type, 'primary'); - expect(result.status, 'available'); - expect(result.error, 'string'); - expect(result.columns, []); - expect(result.lengths, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.key, 'index1'); + expect(result.type, 'primary'); + expect(result.status, 'available'); + expect(result.error, 'string'); + expect(result.columns, []); + expect(result.lengths, []); + }); }); } diff --git a/test/src/models/column_integer_test.dart b/test/src/models/column_integer_test.dart index ee484733..1a411804 100644 --- a/test/src/models/column_integer_test.dart +++ b/test/src/models/column_integer_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnInteger.fromMap(map); - expect(result.key, 'count'); - expect(result.type, 'integer'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'count'); + expect(result.type, 'integer'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_ip_test.dart b/test/src/models/column_ip_test.dart index 8cde17c9..9efe3295 100644 --- a/test/src/models/column_ip_test.dart +++ b/test/src/models/column_ip_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnIp.fromMap(map); - expect(result.key, 'ipAddress'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'ip'); - }); + expect(result.key, 'ipAddress'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'ip'); + }); }); } diff --git a/test/src/models/column_line_test.dart b/test/src/models/column_line_test.dart index a4ffbdb4..a290a8df 100644 --- a/test/src/models/column_line_test.dart +++ b/test/src/models/column_line_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnLine.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_list_test.dart b/test/src/models/column_list_test.dart index 6d8be211..c06d8a23 100644 --- a/test/src/models/column_list_test.dart +++ b/test/src/models/column_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ColumnList.fromMap(map); - expect(result.total, 5); - expect(result.columns, []); - }); + expect(result.total, 5); + expect(result.columns, []); + }); }); } diff --git a/test/src/models/column_longtext_test.dart b/test/src/models/column_longtext_test.dart index a227c789..b4c1ad30 100644 --- a/test/src/models/column_longtext_test.dart +++ b/test/src/models/column_longtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnLongtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_mediumtext_test.dart b/test/src/models/column_mediumtext_test.dart index 27d04b6b..6c460c09 100644 --- a/test/src/models/column_mediumtext_test.dart +++ b/test/src/models/column_mediumtext_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnMediumtext.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_point_test.dart b/test/src/models/column_point_test.dart index 3467e248..43c13448 100644 --- a/test/src/models/column_point_test.dart +++ b/test/src/models/column_point_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnPoint.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_polygon_test.dart b/test/src/models/column_polygon_test.dart index a34ff03f..ef794b1b 100644 --- a/test/src/models/column_polygon_test.dart +++ b/test/src/models/column_polygon_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnPolygon.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_relationship_test.dart b/test/src/models/column_relationship_test.dart index a5b793de..58013bbe 100644 --- a/test/src/models/column_relationship_test.dart +++ b/test/src/models/column_relationship_test.dart @@ -24,19 +24,19 @@ void main() { final map = model.toMap(); final result = ColumnRelationship.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.relatedTable, 'table'); - expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); - expect(result.twoWay, true); - expect(result.twoWayKey, 'string'); - expect(result.onDelete, 'restrict|cascade|setNull'); - expect(result.side, 'parent|child'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.relatedTable, 'table'); + expect(result.relationType, 'oneToOne|oneToMany|manyToOne|manyToMany'); + expect(result.twoWay, true); + expect(result.twoWayKey, 'string'); + expect(result.onDelete, 'restrict|cascade|setNull'); + expect(result.side, 'parent|child'); + }); }); } diff --git a/test/src/models/column_string_test.dart b/test/src/models/column_string_test.dart index 49816f92..af3ee616 100644 --- a/test/src/models/column_string_test.dart +++ b/test/src/models/column_string_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnString.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/column_text_test.dart b/test/src/models/column_text_test.dart index b0900197..2055d538 100644 --- a/test/src/models/column_text_test.dart +++ b/test/src/models/column_text_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = ColumnText.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/column_url_test.dart b/test/src/models/column_url_test.dart index 671b940e..723a1306 100644 --- a/test/src/models/column_url_test.dart +++ b/test/src/models/column_url_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnUrl.fromMap(map); - expect(result.key, 'githubUrl'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.format, 'url'); - }); + expect(result.key, 'githubUrl'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.format, 'url'); + }); }); } diff --git a/test/src/models/column_varchar_test.dart b/test/src/models/column_varchar_test.dart index e805ac09..7cc4424a 100644 --- a/test/src/models/column_varchar_test.dart +++ b/test/src/models/column_varchar_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = ColumnVarchar.fromMap(map); - expect(result.key, 'fullName'); - expect(result.type, 'string'); - expect(result.status, ColumnStatus.available); - expect(result.error, 'string'); - expect(result.xrequired, true); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.size, 128); - }); + expect(result.key, 'fullName'); + expect(result.type, 'string'); + expect(result.status, ColumnStatus.available); + expect(result.error, 'string'); + expect(result.xrequired, true); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.size, 128); + }); }); } diff --git a/test/src/models/continent_list_test.dart b/test/src/models/continent_list_test.dart index 2f78416f..6b139f4d 100644 --- a/test/src/models/continent_list_test.dart +++ b/test/src/models/continent_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ContinentList.fromMap(map); - expect(result.total, 5); - expect(result.continents, []); - }); + expect(result.total, 5); + expect(result.continents, []); + }); }); } diff --git a/test/src/models/continent_test.dart b/test/src/models/continent_test.dart index 1cf934a3..656cc010 100644 --- a/test/src/models/continent_test.dart +++ b/test/src/models/continent_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = Continent.fromMap(map); - expect(result.name, 'Europe'); - expect(result.code, 'EU'); - }); + expect(result.name, 'Europe'); + expect(result.code, 'EU'); + }); }); } diff --git a/test/src/models/country_list_test.dart b/test/src/models/country_list_test.dart index 1c5ee7cc..71b0d477 100644 --- a/test/src/models/country_list_test.dart +++ b/test/src/models/country_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = CountryList.fromMap(map); - expect(result.total, 5); - expect(result.countries, []); - }); + expect(result.total, 5); + expect(result.countries, []); + }); }); } diff --git a/test/src/models/country_test.dart b/test/src/models/country_test.dart index f41d3cdb..f4eec5ee 100644 --- a/test/src/models/country_test.dart +++ b/test/src/models/country_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = Country.fromMap(map); - expect(result.name, 'United States'); - expect(result.code, 'US'); - }); + expect(result.name, 'United States'); + expect(result.code, 'US'); + }); }); } diff --git a/test/src/models/currency_list_test.dart b/test/src/models/currency_list_test.dart index 3612e8b0..36add198 100644 --- a/test/src/models/currency_list_test.dart +++ b/test/src/models/currency_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = CurrencyList.fromMap(map); - expect(result.total, 5); - expect(result.currencies, []); - }); + expect(result.total, 5); + expect(result.currencies, []); + }); }); } diff --git a/test/src/models/currency_test.dart b/test/src/models/currency_test.dart index 35e511f9..05fef236 100644 --- a/test/src/models/currency_test.dart +++ b/test/src/models/currency_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = Currency.fromMap(map); - expect(result.symbol, '\$'); - expect(result.name, 'US dollar'); - expect(result.symbolNative, '\$'); - expect(result.decimalDigits, 2); - expect(result.rounding, 0); - expect(result.code, 'USD'); - expect(result.namePlural, 'US dollars'); - }); + expect(result.symbol, '\$'); + expect(result.name, 'US dollar'); + expect(result.symbolNative, '\$'); + expect(result.decimalDigits, 2); + expect(result.rounding, 0); + expect(result.code, 'USD'); + expect(result.namePlural, 'US dollars'); + }); }); } diff --git a/test/src/models/database_list_test.dart b/test/src/models/database_list_test.dart index 15e44083..ec1c0150 100644 --- a/test/src/models/database_list_test.dart +++ b/test/src/models/database_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = DatabaseList.fromMap(map); - expect(result.total, 5); - expect(result.databases, []); - }); + expect(result.total, 5); + expect(result.databases, []); + }); }); } diff --git a/test/src/models/database_test.dart b/test/src/models/database_test.dart index bfbd8ae5..fff6a7e2 100644 --- a/test/src/models/database_test.dart +++ b/test/src/models/database_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = Database.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.name, 'My Database'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.enabled, true); - expect(result.type, DatabaseType.legacy); - expect(result.policies, []); - expect(result.archives, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.name, 'My Database'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.enabled, true); + expect(result.type, DatabaseType.legacy); + expect(result.policies, []); + expect(result.archives, []); + }); }); } diff --git a/test/src/models/deployment_list_test.dart b/test/src/models/deployment_list_test.dart index a0689888..64f2e6b9 100644 --- a/test/src/models/deployment_list_test.dart +++ b/test/src/models/deployment_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = DeploymentList.fromMap(map); - expect(result.total, 5); - expect(result.deployments, []); - }); + expect(result.total, 5); + expect(result.deployments, []); + }); }); } diff --git a/test/src/models/deployment_test.dart b/test/src/models/deployment_test.dart index 16f003b2..956ea5a5 100644 --- a/test/src/models/deployment_test.dart +++ b/test/src/models/deployment_test.dart @@ -25,46 +25,53 @@ void main() { buildDuration: 128, providerRepositoryName: 'database', providerRepositoryOwner: 'utopia', - providerRepositoryUrl: 'https://github.com/vermakhushboo/g4-node-function', + providerRepositoryUrl: + 'https://github.com/vermakhushboo/g4-node-function', providerCommitHash: '7c3f25d', providerCommitAuthorUrl: 'https://github.com/vermakhushboo', providerCommitAuthor: 'Khushboo Verma', providerCommitMessage: 'Update index.js', - providerCommitUrl: 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + providerCommitUrl: + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', providerBranch: '0.7.x', - providerBranchUrl: 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', + providerBranchUrl: + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x', ); final map = model.toMap(); final result = Deployment.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.type, 'vcs'); - expect(result.resourceId, '5e5ea6g16897e'); - expect(result.resourceType, 'functions'); - expect(result.entrypoint, 'index.js'); - expect(result.sourceSize, 128); - expect(result.buildSize, 128); - expect(result.totalSize, 128); - expect(result.buildId, '5e5ea5c16897e'); - expect(result.activate, true); - expect(result.screenshotLight, '5e5ea5c16897e'); - expect(result.screenshotDark, '5e5ea5c16897e'); - expect(result.status, DeploymentStatus.waiting); - expect(result.buildLogs, 'Compiling source files...'); - expect(result.buildDuration, 128); - expect(result.providerRepositoryName, 'database'); - expect(result.providerRepositoryOwner, 'utopia'); - expect(result.providerRepositoryUrl, 'https://github.com/vermakhushboo/g4-node-function'); - expect(result.providerCommitHash, '7c3f25d'); - expect(result.providerCommitAuthorUrl, 'https://github.com/vermakhushboo'); - expect(result.providerCommitAuthor, 'Khushboo Verma'); - expect(result.providerCommitMessage, 'Update index.js'); - expect(result.providerCommitUrl, 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb'); - expect(result.providerBranch, '0.7.x'); - expect(result.providerBranchUrl, 'https://github.com/vermakhushboo/appwrite/tree/0.7.x'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.type, 'vcs'); + expect(result.resourceId, '5e5ea6g16897e'); + expect(result.resourceType, 'functions'); + expect(result.entrypoint, 'index.js'); + expect(result.sourceSize, 128); + expect(result.buildSize, 128); + expect(result.totalSize, 128); + expect(result.buildId, '5e5ea5c16897e'); + expect(result.activate, true); + expect(result.screenshotLight, '5e5ea5c16897e'); + expect(result.screenshotDark, '5e5ea5c16897e'); + expect(result.status, DeploymentStatus.waiting); + expect(result.buildLogs, 'Compiling source files...'); + expect(result.buildDuration, 128); + expect(result.providerRepositoryName, 'database'); + expect(result.providerRepositoryOwner, 'utopia'); + expect(result.providerRepositoryUrl, + 'https://github.com/vermakhushboo/g4-node-function'); + expect(result.providerCommitHash, '7c3f25d'); + expect( + result.providerCommitAuthorUrl, 'https://github.com/vermakhushboo'); + expect(result.providerCommitAuthor, 'Khushboo Verma'); + expect(result.providerCommitMessage, 'Update index.js'); + expect(result.providerCommitUrl, + 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb'); + expect(result.providerBranch, '0.7.x'); + expect(result.providerBranchUrl, + 'https://github.com/vermakhushboo/appwrite/tree/0.7.x'); + }); }); } diff --git a/test/src/models/dev_key_test.dart b/test/src/models/dev_key_test.dart index 43460d50..3a318814 100644 --- a/test/src/models/dev_key_test.dart +++ b/test/src/models/dev_key_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = DevKey.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'Dev API Key'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.sdks, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'Dev API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); }); } diff --git a/test/src/models/document_list_test.dart b/test/src/models/document_list_test.dart index b2dab5c4..18ed1c09 100644 --- a/test/src/models/document_list_test.dart +++ b/test/src/models/document_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = DocumentList.fromMap(map); - expect(result.total, 5); - expect(result.documents, []); - }); + expect(result.total, 5); + expect(result.documents, []); + }); }); } diff --git a/test/src/models/document_test.dart b/test/src/models/document_test.dart index 4d0d7975..5fbdc12c 100644 --- a/test/src/models/document_test.dart +++ b/test/src/models/document_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = Document.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$sequence, '1'); - expect(result.$collectionId, '5e5ea5c15117e'); - expect(result.$databaseId, '5e5ea5c15117e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$collectionId, '5e5ea5c15117e'); + expect(result.$databaseId, '5e5ea5c15117e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + }); }); } diff --git a/test/src/models/email_template_list_test.dart b/test/src/models/email_template_list_test.dart index d755c37f..5cbb97e3 100644 --- a/test/src/models/email_template_list_test.dart +++ b/test/src/models/email_template_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = EmailTemplateList.fromMap(map); - expect(result.total, 5); - expect(result.templates, []); - }); + expect(result.total, 5); + expect(result.templates, []); + }); }); } diff --git a/test/src/models/email_template_test.dart b/test/src/models/email_template_test.dart index 8c257278..d8ae307a 100644 --- a/test/src/models/email_template_test.dart +++ b/test/src/models/email_template_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = EmailTemplate.fromMap(map); - expect(result.templateId, 'verification'); - expect(result.locale, 'en_us'); - expect(result.message, 'Click on the link to verify your account.'); - expect(result.senderName, 'My User'); - expect(result.senderEmail, 'mail@appwrite.io'); - expect(result.replyToEmail, 'emails@appwrite.io'); - expect(result.replyToName, 'Support Team'); - expect(result.subject, 'Please verify your email address'); - }); + expect(result.templateId, 'verification'); + expect(result.locale, 'en_us'); + expect(result.message, 'Click on the link to verify your account.'); + expect(result.senderName, 'My User'); + expect(result.senderEmail, 'mail@appwrite.io'); + expect(result.replyToEmail, 'emails@appwrite.io'); + expect(result.replyToName, 'Support Team'); + expect(result.subject, 'Please verify your email address'); + }); }); } diff --git a/test/src/models/ephemeral_key_test.dart b/test/src/models/ephemeral_key_test.dart index 9b4c56b9..10b392f2 100644 --- a/test/src/models/ephemeral_key_test.dart +++ b/test/src/models/ephemeral_key_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = EphemeralKey.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My API Key'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.scopes, []); - expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.sdks, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.scopes, []); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); }); } diff --git a/test/src/models/execution_list_test.dart b/test/src/models/execution_list_test.dart index 6bda2fa5..ba36364e 100644 --- a/test/src/models/execution_list_test.dart +++ b/test/src/models/execution_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ExecutionList.fromMap(map); - expect(result.total, 5); - expect(result.executions, []); - }); + expect(result.total, 5); + expect(result.executions, []); + }); }); } diff --git a/test/src/models/execution_test.dart b/test/src/models/execution_test.dart index 0e1b7b9c..53b36c9e 100644 --- a/test/src/models/execution_test.dart +++ b/test/src/models/execution_test.dart @@ -28,23 +28,23 @@ void main() { final map = model.toMap(); final result = Execution.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.functionId, '5e5ea6g16897e'); - expect(result.deploymentId, '5e5ea5c16897e'); - expect(result.trigger, ExecutionTrigger.http); - expect(result.status, ExecutionStatus.waiting); - expect(result.requestMethod, 'GET'); - expect(result.requestPath, '/articles?id=5'); - expect(result.requestHeaders, []); - expect(result.responseStatusCode, 200); - expect(result.responseBody, ''); - expect(result.responseHeaders, []); - expect(result.logs, ''); - expect(result.errors, ''); - expect(result.duration, 0.4); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.functionId, '5e5ea6g16897e'); + expect(result.deploymentId, '5e5ea5c16897e'); + expect(result.trigger, ExecutionTrigger.http); + expect(result.status, ExecutionStatus.waiting); + expect(result.requestMethod, 'GET'); + expect(result.requestPath, '/articles?id=5'); + expect(result.requestHeaders, []); + expect(result.responseStatusCode, 200); + expect(result.responseBody, ''); + expect(result.responseHeaders, []); + expect(result.logs, ''); + expect(result.errors, ''); + expect(result.duration, 0.4); + }); }); } diff --git a/test/src/models/file_list_test.dart b/test/src/models/file_list_test.dart index c60fac86..132c43b3 100644 --- a/test/src/models/file_list_test.dart +++ b/test/src/models/file_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = FileList.fromMap(map); - expect(result.total, 5); - expect(result.files, []); - }); + expect(result.total, 5); + expect(result.files, []); + }); }); } diff --git a/test/src/models/file_test.dart b/test/src/models/file_test.dart index ba229c32..c515412d 100644 --- a/test/src/models/file_test.dart +++ b/test/src/models/file_test.dart @@ -23,19 +23,19 @@ void main() { final map = model.toMap(); final result = File.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.bucketId, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.name, 'Pink.png'); - expect(result.signature, '5d529fd02b544198ae075bd57c1762bb'); - expect(result.mimeType, 'image/png'); - expect(result.sizeOriginal, 17890); - expect(result.chunksTotal, 17890); - expect(result.chunksUploaded, 17890); - expect(result.encryption, true); - expect(result.compression, 'gzip'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.bucketId, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.name, 'Pink.png'); + expect(result.signature, '5d529fd02b544198ae075bd57c1762bb'); + expect(result.mimeType, 'image/png'); + expect(result.sizeOriginal, 17890); + expect(result.chunksTotal, 17890); + expect(result.chunksUploaded, 17890); + expect(result.encryption, true); + expect(result.compression, 'gzip'); + }); }); } diff --git a/test/src/models/framework_adapter_test.dart b/test/src/models/framework_adapter_test.dart index a7b5ed65..e892cf0d 100644 --- a/test/src/models/framework_adapter_test.dart +++ b/test/src/models/framework_adapter_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = FrameworkAdapter.fromMap(map); - expect(result.key, 'static'); - expect(result.installCommand, 'npm install'); - expect(result.buildCommand, 'npm run build'); - expect(result.outputDirectory, './dist'); - expect(result.fallbackFile, 'index.html'); - }); + expect(result.key, 'static'); + expect(result.installCommand, 'npm install'); + expect(result.buildCommand, 'npm run build'); + expect(result.outputDirectory, './dist'); + expect(result.fallbackFile, 'index.html'); + }); }); } diff --git a/test/src/models/framework_list_test.dart b/test/src/models/framework_list_test.dart index 7b2a29b8..faeae12a 100644 --- a/test/src/models/framework_list_test.dart +++ b/test/src/models/framework_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = FrameworkList.fromMap(map); - expect(result.total, 5); - expect(result.frameworks, []); - }); + expect(result.total, 5); + expect(result.frameworks, []); + }); }); } diff --git a/test/src/models/framework_test.dart b/test/src/models/framework_test.dart index 20744ab0..07ce1e79 100644 --- a/test/src/models/framework_test.dart +++ b/test/src/models/framework_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = Framework.fromMap(map); - expect(result.key, 'sveltekit'); - expect(result.name, 'SvelteKit'); - expect(result.buildRuntime, 'node-22'); - expect(result.runtimes, []); - expect(result.adapters, []); - }); + expect(result.key, 'sveltekit'); + expect(result.name, 'SvelteKit'); + expect(result.buildRuntime, 'node-22'); + expect(result.runtimes, []); + expect(result.adapters, []); + }); }); } diff --git a/test/src/models/function_list_test.dart b/test/src/models/function_list_test.dart index 2d4d974d..81a86955 100644 --- a/test/src/models/function_list_test.dart +++ b/test/src/models/function_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = FunctionList.fromMap(map); - expect(result.total, 5); - expect(result.functions, []); - }); + expect(result.total, 5); + expect(result.functions, []); + }); }); } diff --git a/test/src/models/function_test.dart b/test/src/models/function_test.dart index e11a724f..8a0dfb7e 100644 --- a/test/src/models/function_test.dart +++ b/test/src/models/function_test.dart @@ -40,36 +40,36 @@ void main() { final map = model.toMap(); final result = Func.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.execute, []); - expect(result.name, 'My Function'); - expect(result.enabled, true); - expect(result.live, true); - expect(result.logging, true); - expect(result.runtime, 'python-3.8'); - expect(result.deploymentRetention, 7); - expect(result.deploymentId, '5e5ea5c16897e'); - expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.latestDeploymentId, '5e5ea5c16897e'); - expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.latestDeploymentStatus, 'ready'); - expect(result.scopes, []); - expect(result.vars, []); - expect(result.events, []); - expect(result.schedule, '5 4 * * *'); - expect(result.timeout, 300); - expect(result.entrypoint, 'index.js'); - expect(result.commands, 'npm install'); - expect(result.version, 'v2'); - expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); - expect(result.providerRepositoryId, 'appwrite'); - expect(result.providerBranch, 'main'); - expect(result.providerRootDirectory, 'functions/helloWorld'); - expect(result.providerSilentMode, true); - expect(result.buildSpecification, 's-1vcpu-512mb'); - expect(result.runtimeSpecification, 's-1vcpu-512mb'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.execute, []); + expect(result.name, 'My Function'); + expect(result.enabled, true); + expect(result.live, true); + expect(result.logging, true); + expect(result.runtime, 'python-3.8'); + expect(result.deploymentRetention, 7); + expect(result.deploymentId, '5e5ea5c16897e'); + expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.latestDeploymentId, '5e5ea5c16897e'); + expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.latestDeploymentStatus, 'ready'); + expect(result.scopes, []); + expect(result.vars, []); + expect(result.events, []); + expect(result.schedule, '5 4 * * *'); + expect(result.timeout, 300); + expect(result.entrypoint, 'index.js'); + expect(result.commands, 'npm install'); + expect(result.version, 'v2'); + expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); + expect(result.providerRepositoryId, 'appwrite'); + expect(result.providerBranch, 'main'); + expect(result.providerRootDirectory, 'functions/helloWorld'); + expect(result.providerSilentMode, true); + expect(result.buildSpecification, 's-1vcpu-512mb'); + expect(result.runtimeSpecification, 's-1vcpu-512mb'); + }); }); } diff --git a/test/src/models/headers_test.dart b/test/src/models/headers_test.dart index d3abb67f..1d79dcad 100644 --- a/test/src/models/headers_test.dart +++ b/test/src/models/headers_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = Headers.fromMap(map); - expect(result.name, 'Content-Type'); - expect(result.value, 'application/json'); - }); + expect(result.name, 'Content-Type'); + expect(result.value, 'application/json'); + }); }); } diff --git a/test/src/models/health_antivirus_test.dart b/test/src/models/health_antivirus_test.dart index d09a016b..69628d5d 100644 --- a/test/src/models/health_antivirus_test.dart +++ b/test/src/models/health_antivirus_test.dart @@ -13,8 +13,8 @@ void main() { final map = model.toMap(); final result = HealthAntivirus.fromMap(map); - expect(result.version, '1.0.0'); - expect(result.status, HealthAntivirusStatus.disabled); - }); + expect(result.version, '1.0.0'); + expect(result.status, HealthAntivirusStatus.disabled); + }); }); } diff --git a/test/src/models/health_certificate_test.dart b/test/src/models/health_certificate_test.dart index 9915fd80..3a6f1d4c 100644 --- a/test/src/models/health_certificate_test.dart +++ b/test/src/models/health_certificate_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = HealthCertificate.fromMap(map); - expect(result.name, '/CN=www.google.com'); - expect(result.subjectSN, ''); - expect(result.issuerOrganisation, ''); - expect(result.validFrom, '1704200998'); - expect(result.validTo, '1711458597'); - expect(result.signatureTypeSN, 'RSA-SHA256'); - }); + expect(result.name, '/CN=www.google.com'); + expect(result.subjectSN, ''); + expect(result.issuerOrganisation, ''); + expect(result.validFrom, '1704200998'); + expect(result.validTo, '1711458597'); + expect(result.signatureTypeSN, 'RSA-SHA256'); + }); }); } diff --git a/test/src/models/health_queue_test.dart b/test/src/models/health_queue_test.dart index ab040ebd..3cb77741 100644 --- a/test/src/models/health_queue_test.dart +++ b/test/src/models/health_queue_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = HealthQueue.fromMap(map); - expect(result.size, 8); - }); + expect(result.size, 8); + }); }); } diff --git a/test/src/models/health_status_list_test.dart b/test/src/models/health_status_list_test.dart index a03756b0..d14468c8 100644 --- a/test/src/models/health_status_list_test.dart +++ b/test/src/models/health_status_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = HealthStatusList.fromMap(map); - expect(result.total, 5); - expect(result.statuses, []); - }); + expect(result.total, 5); + expect(result.statuses, []); + }); }); } diff --git a/test/src/models/health_status_test.dart b/test/src/models/health_status_test.dart index e98c788f..4952b462 100644 --- a/test/src/models/health_status_test.dart +++ b/test/src/models/health_status_test.dart @@ -14,9 +14,9 @@ void main() { final map = model.toMap(); final result = HealthStatus.fromMap(map); - expect(result.name, 'database'); - expect(result.ping, 128); - expect(result.status, HealthCheckStatus.pass); - }); + expect(result.name, 'database'); + expect(result.ping, 128); + expect(result.status, HealthCheckStatus.pass); + }); }); } diff --git a/test/src/models/health_time_test.dart b/test/src/models/health_time_test.dart index 2455d9cd..12998d00 100644 --- a/test/src/models/health_time_test.dart +++ b/test/src/models/health_time_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = HealthTime.fromMap(map); - expect(result.remoteTime, 1639490751); - expect(result.localTime, 1639490844); - expect(result.diff, 93); - }); + expect(result.remoteTime, 1639490751); + expect(result.localTime, 1639490844); + expect(result.diff, 93); + }); }); } diff --git a/test/src/models/identity_list_test.dart b/test/src/models/identity_list_test.dart index d3d477be..d3bf6876 100644 --- a/test/src/models/identity_list_test.dart +++ b/test/src/models/identity_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = IdentityList.fromMap(map); - expect(result.total, 5); - expect(result.identities, []); - }); + expect(result.total, 5); + expect(result.identities, []); + }); }); } diff --git a/test/src/models/identity_test.dart b/test/src/models/identity_test.dart index 3826d358..680b7497 100644 --- a/test/src/models/identity_test.dart +++ b/test/src/models/identity_test.dart @@ -20,16 +20,16 @@ void main() { final map = model.toMap(); final result = Identity.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5bb8c16897e'); - expect(result.provider, 'email'); - expect(result.providerUid, '5e5bb8c16897e'); - expect(result.providerEmail, 'user@example.com'); - expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); - expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5bb8c16897e'); + expect(result.provider, 'email'); + expect(result.providerUid, '5e5bb8c16897e'); + expect(result.providerEmail, 'user@example.com'); + expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); + expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + }); }); } diff --git a/test/src/models/index_list_test.dart b/test/src/models/index_list_test.dart index fb68500c..07b7e4d1 100644 --- a/test/src/models/index_list_test.dart +++ b/test/src/models/index_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = IndexList.fromMap(map); - expect(result.total, 5); - expect(result.indexes, []); - }); + expect(result.total, 5); + expect(result.indexes, []); + }); }); } diff --git a/test/src/models/index_test.dart b/test/src/models/index_test.dart index 922976a3..c6a23779 100644 --- a/test/src/models/index_test.dart +++ b/test/src/models/index_test.dart @@ -20,15 +20,15 @@ void main() { final map = model.toMap(); final result = Index.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.key, 'index1'); - expect(result.type, 'primary'); - expect(result.status, IndexStatus.available); - expect(result.error, 'string'); - expect(result.attributes, []); - expect(result.lengths, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.key, 'index1'); + expect(result.type, 'primary'); + expect(result.status, IndexStatus.available); + expect(result.error, 'string'); + expect(result.attributes, []); + expect(result.lengths, []); + }); }); } diff --git a/test/src/models/jwt_test.dart b/test/src/models/jwt_test.dart index a45857b3..c6b2df28 100644 --- a/test/src/models/jwt_test.dart +++ b/test/src/models/jwt_test.dart @@ -5,13 +5,15 @@ void main() { group('Jwt', () { test('model', () { final model = Jwt( - jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + jwt: + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', ); final map = model.toMap(); final result = Jwt.fromMap(map); - expect(result.jwt, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); - }); + expect(result.jwt, + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); + }); }); } diff --git a/test/src/models/key_list_test.dart b/test/src/models/key_list_test.dart index cdea8b07..97747078 100644 --- a/test/src/models/key_list_test.dart +++ b/test/src/models/key_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = KeyList.fromMap(map); - expect(result.total, 5); - expect(result.keys, []); - }); + expect(result.total, 5); + expect(result.keys, []); + }); }); } diff --git a/test/src/models/key_test.dart b/test/src/models/key_test.dart index 7b443385..2050b172 100644 --- a/test/src/models/key_test.dart +++ b/test/src/models/key_test.dart @@ -19,15 +19,15 @@ void main() { final map = model.toMap(); final result = Key.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My API Key'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.scopes, []); - expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.sdks, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My API Key'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.scopes, []); + expect(result.secret, '919c2d18fb5d4...a2ae413da83346ad2'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.sdks, []); + }); }); } diff --git a/test/src/models/language_list_test.dart b/test/src/models/language_list_test.dart index fe8fd5ad..fd0dd58c 100644 --- a/test/src/models/language_list_test.dart +++ b/test/src/models/language_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LanguageList.fromMap(map); - expect(result.total, 5); - expect(result.languages, []); - }); + expect(result.total, 5); + expect(result.languages, []); + }); }); } diff --git a/test/src/models/language_test.dart b/test/src/models/language_test.dart index b8c302be..6db0ddbf 100644 --- a/test/src/models/language_test.dart +++ b/test/src/models/language_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = Language.fromMap(map); - expect(result.name, 'Italian'); - expect(result.code, 'it'); - expect(result.nativeName, 'Italiano'); - }); + expect(result.name, 'Italian'); + expect(result.code, 'it'); + expect(result.nativeName, 'Italiano'); + }); }); } diff --git a/test/src/models/locale_code_list_test.dart b/test/src/models/locale_code_list_test.dart index 0f1be0d2..c086cdd1 100644 --- a/test/src/models/locale_code_list_test.dart +++ b/test/src/models/locale_code_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LocaleCodeList.fromMap(map); - expect(result.total, 5); - expect(result.localeCodes, []); - }); + expect(result.total, 5); + expect(result.localeCodes, []); + }); }); } diff --git a/test/src/models/locale_code_test.dart b/test/src/models/locale_code_test.dart index bf3b0c2c..26116578 100644 --- a/test/src/models/locale_code_test.dart +++ b/test/src/models/locale_code_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LocaleCode.fromMap(map); - expect(result.code, 'en-us'); - expect(result.name, 'US'); - }); + expect(result.code, 'en-us'); + expect(result.name, 'US'); + }); }); } diff --git a/test/src/models/locale_test.dart b/test/src/models/locale_test.dart index 3def85b0..0b65d14a 100644 --- a/test/src/models/locale_test.dart +++ b/test/src/models/locale_test.dart @@ -17,13 +17,13 @@ void main() { final map = model.toMap(); final result = Locale.fromMap(map); - expect(result.ip, '127.0.0.1'); - expect(result.countryCode, 'US'); - expect(result.country, 'United States'); - expect(result.continentCode, 'NA'); - expect(result.continent, 'North America'); - expect(result.eu, true); - expect(result.currency, 'USD'); - }); + expect(result.ip, '127.0.0.1'); + expect(result.countryCode, 'US'); + expect(result.country, 'United States'); + expect(result.continentCode, 'NA'); + expect(result.continent, 'North America'); + expect(result.eu, true); + expect(result.currency, 'USD'); + }); }); } diff --git a/test/src/models/log_list_test.dart b/test/src/models/log_list_test.dart index c308bc58..a66cdabf 100644 --- a/test/src/models/log_list_test.dart +++ b/test/src/models/log_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = LogList.fromMap(map); - expect(result.total, 5); - expect(result.logs, []); - }); + expect(result.total, 5); + expect(result.logs, []); + }); }); } diff --git a/test/src/models/log_test.dart b/test/src/models/log_test.dart index ecc91978..24273a11 100644 --- a/test/src/models/log_test.dart +++ b/test/src/models/log_test.dart @@ -32,28 +32,28 @@ void main() { final map = model.toMap(); final result = Log.fromMap(map); - expect(result.event, 'account.sessions.create'); - expect(result.userId, '610fc2f985ee0'); - expect(result.userEmail, 'john@appwrite.io'); - expect(result.userName, 'John Doe'); - expect(result.mode, 'admin'); - expect(result.userType, 'user'); - expect(result.ip, '127.0.0.1'); - expect(result.time, '2020-10-15T06:38:00.000+00:00'); - expect(result.osCode, 'Mac'); - expect(result.osName, 'Mac'); - expect(result.osVersion, 'Mac'); - expect(result.clientType, 'browser'); - expect(result.clientCode, 'CM'); - expect(result.clientName, 'Chrome Mobile iOS'); - expect(result.clientVersion, '84.0'); - expect(result.clientEngine, 'WebKit'); - expect(result.clientEngineVersion, '605.1.15'); - expect(result.deviceName, 'smartphone'); - expect(result.deviceBrand, 'Google'); - expect(result.deviceModel, 'Nexus 5'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - }); + expect(result.event, 'account.sessions.create'); + expect(result.userId, '610fc2f985ee0'); + expect(result.userEmail, 'john@appwrite.io'); + expect(result.userName, 'John Doe'); + expect(result.mode, 'admin'); + expect(result.userType, 'user'); + expect(result.ip, '127.0.0.1'); + expect(result.time, '2020-10-15T06:38:00.000+00:00'); + expect(result.osCode, 'Mac'); + expect(result.osName, 'Mac'); + expect(result.osVersion, 'Mac'); + expect(result.clientType, 'browser'); + expect(result.clientCode, 'CM'); + expect(result.clientName, 'Chrome Mobile iOS'); + expect(result.clientVersion, '84.0'); + expect(result.clientEngine, 'WebKit'); + expect(result.clientEngineVersion, '605.1.15'); + expect(result.deviceName, 'smartphone'); + expect(result.deviceBrand, 'Google'); + expect(result.deviceModel, 'Nexus 5'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + }); }); } diff --git a/test/src/models/membership_list_test.dart b/test/src/models/membership_list_test.dart index dd9dab7c..0f0f0d60 100644 --- a/test/src/models/membership_list_test.dart +++ b/test/src/models/membership_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = MembershipList.fromMap(map); - expect(result.total, 5); - expect(result.memberships, []); - }); + expect(result.total, 5); + expect(result.memberships, []); + }); }); } diff --git a/test/src/models/membership_test.dart b/test/src/models/membership_test.dart index 3d38d8f4..4e609f85 100644 --- a/test/src/models/membership_test.dart +++ b/test/src/models/membership_test.dart @@ -24,20 +24,20 @@ void main() { final map = model.toMap(); final result = Membership.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5ea5c16897e'); - expect(result.userName, 'John Doe'); - expect(result.userEmail, 'john@appwrite.io'); - expect(result.userPhone, '+1 555 555 5555'); - expect(result.teamId, '5e5ea5c16897e'); - expect(result.teamName, 'VIP'); - expect(result.invited, '2020-10-15T06:38:00.000+00:00'); - expect(result.joined, '2020-10-15T06:38:00.000+00:00'); - expect(result.confirm, true); - expect(result.mfa, true); - expect(result.roles, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5ea5c16897e'); + expect(result.userName, 'John Doe'); + expect(result.userEmail, 'john@appwrite.io'); + expect(result.userPhone, '+1 555 555 5555'); + expect(result.teamId, '5e5ea5c16897e'); + expect(result.teamName, 'VIP'); + expect(result.invited, '2020-10-15T06:38:00.000+00:00'); + expect(result.joined, '2020-10-15T06:38:00.000+00:00'); + expect(result.confirm, true); + expect(result.mfa, true); + expect(result.roles, []); + }); }); } diff --git a/test/src/models/message_list_test.dart b/test/src/models/message_list_test.dart index cb972d14..cd22ec3a 100644 --- a/test/src/models/message_list_test.dart +++ b/test/src/models/message_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = MessageList.fromMap(map); - expect(result.total, 5); - expect(result.messages, []); - }); + expect(result.total, 5); + expect(result.messages, []); + }); }); } diff --git a/test/src/models/message_test.dart b/test/src/models/message_test.dart index 330e09a0..1ef04c69 100644 --- a/test/src/models/message_test.dart +++ b/test/src/models/message_test.dart @@ -21,16 +21,16 @@ void main() { final map = model.toMap(); final result = Message.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.providerType, 'email'); - expect(result.topics, []); - expect(result.users, []); - expect(result.targets, []); - expect(result.deliveredTotal, 1); - expect(result.data, {}); - expect(result.status, MessageStatus.draft); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.providerType, 'email'); + expect(result.topics, []); + expect(result.users, []); + expect(result.targets, []); + expect(result.deliveredTotal, 1); + expect(result.data, {}); + expect(result.status, MessageStatus.draft); + }); }); } diff --git a/test/src/models/mfa_challenge_test.dart b/test/src/models/mfa_challenge_test.dart index e5a9e0f1..568d6e83 100644 --- a/test/src/models/mfa_challenge_test.dart +++ b/test/src/models/mfa_challenge_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = MfaChallenge.fromMap(map); - expect(result.$id, 'bb8ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5ea5c168bb8'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, 'bb8ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5ea5c168bb8'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/mfa_factors_test.dart b/test/src/models/mfa_factors_test.dart index 799dd80e..59b7e2c7 100644 --- a/test/src/models/mfa_factors_test.dart +++ b/test/src/models/mfa_factors_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = MfaFactors.fromMap(map); - expect(result.totp, true); - expect(result.phone, true); - expect(result.email, true); - expect(result.recoveryCode, true); - }); + expect(result.totp, true); + expect(result.phone, true); + expect(result.email, true); + expect(result.recoveryCode, true); + }); }); } diff --git a/test/src/models/mfa_recovery_codes_test.dart b/test/src/models/mfa_recovery_codes_test.dart index 759cb0f6..36eb4701 100644 --- a/test/src/models/mfa_recovery_codes_test.dart +++ b/test/src/models/mfa_recovery_codes_test.dart @@ -11,7 +11,7 @@ void main() { final map = model.toMap(); final result = MfaRecoveryCodes.fromMap(map); - expect(result.recoveryCodes, []); - }); + expect(result.recoveryCodes, []); + }); }); } diff --git a/test/src/models/mfa_type_test.dart b/test/src/models/mfa_type_test.dart index 2e9cb251..e391105b 100644 --- a/test/src/models/mfa_type_test.dart +++ b/test/src/models/mfa_type_test.dart @@ -6,14 +6,16 @@ void main() { test('model', () { final model = MfaType( secret: '[SHARED_SECRET]', - uri: 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', + uri: + 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite', ); final map = model.toMap(); final result = MfaType.fromMap(map); - expect(result.secret, '[SHARED_SECRET]'); - expect(result.uri, 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite'); - }); + expect(result.secret, '[SHARED_SECRET]'); + expect(result.uri, + 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite'); + }); }); } diff --git a/test/src/models/mock_number_list_test.dart b/test/src/models/mock_number_list_test.dart index a1b8044a..79224b0a 100644 --- a/test/src/models/mock_number_list_test.dart +++ b/test/src/models/mock_number_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = MockNumberList.fromMap(map); - expect(result.total, 5); - expect(result.mockNumbers, []); - }); + expect(result.total, 5); + expect(result.mockNumbers, []); + }); }); } diff --git a/test/src/models/mock_number_test.dart b/test/src/models/mock_number_test.dart index 61ba8703..55f3c5ff 100644 --- a/test/src/models/mock_number_test.dart +++ b/test/src/models/mock_number_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = MockNumber.fromMap(map); - expect(result.number, '+1612842323'); - expect(result.otp, '123456'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.number, '+1612842323'); + expect(result.otp, '123456'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/o_auth2_amazon_test.dart b/test/src/models/o_auth2_amazon_test.dart index 3c58c742..d859f1d3 100644 --- a/test/src/models/o_auth2_amazon_test.dart +++ b/test/src/models/o_auth2_amazon_test.dart @@ -7,17 +7,21 @@ void main() { final model = OAuth2Amazon( $id: 'github', enabled: true, - clientId: 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', - clientSecret: '79ffe4000000000000000000000000000000000000000000000000000002de55', + clientId: + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + clientSecret: + '79ffe4000000000000000000000000000000000000000000000000000002de55', ); final map = model.toMap(); final result = OAuth2Amazon.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2'); - expect(result.clientSecret, '79ffe4000000000000000000000000000000000000000000000000000002de55'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, + 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2'); + expect(result.clientSecret, + '79ffe4000000000000000000000000000000000000000000000000000002de55'); + }); }); } diff --git a/test/src/models/o_auth2_apple_test.dart b/test/src/models/o_auth2_apple_test.dart index b3935804..e95e59dc 100644 --- a/test/src/models/o_auth2_apple_test.dart +++ b/test/src/models/o_auth2_apple_test.dart @@ -10,18 +10,20 @@ void main() { serviceId: 'ip.appwrite.app.web', keyId: 'P4000000N8', teamId: 'D4000000R6', - p8File: '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', + p8File: + '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----', ); final map = model.toMap(); final result = OAuth2Apple.fromMap(map); - expect(result.$id, 'apple'); - expect(result.enabled, true); - expect(result.serviceId, 'ip.appwrite.app.web'); - expect(result.keyId, 'P4000000N8'); - expect(result.teamId, 'D4000000R6'); - expect(result.p8File, '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----'); - }); + expect(result.$id, 'apple'); + expect(result.enabled, true); + expect(result.serviceId, 'ip.appwrite.app.web'); + expect(result.keyId, 'P4000000N8'); + expect(result.teamId, 'D4000000R6'); + expect(result.p8File, + '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----'); + }); }); } diff --git a/test/src/models/o_auth2_auth0_test.dart b/test/src/models/o_auth2_auth0_test.dart index 3b4d9bf0..404fc1ed 100644 --- a/test/src/models/o_auth2_auth0_test.dart +++ b/test/src/models/o_auth2_auth0_test.dart @@ -8,18 +8,20 @@ void main() { $id: 'github', enabled: true, clientId: 'OaOkIA000000000000000000005KLSYq', - clientSecret: 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + clientSecret: + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', endpoint: 'example.us.auth0.com', ); final map = model.toMap(); final result = OAuth2Auth0.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'OaOkIA000000000000000000005KLSYq'); - expect(result.clientSecret, 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF'); - expect(result.endpoint, 'example.us.auth0.com'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'OaOkIA000000000000000000005KLSYq'); + expect(result.clientSecret, + 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF'); + expect(result.endpoint, 'example.us.auth0.com'); + }); }); } diff --git a/test/src/models/o_auth2_authentik_test.dart b/test/src/models/o_auth2_authentik_test.dart index 0a289531..1aefd251 100644 --- a/test/src/models/o_auth2_authentik_test.dart +++ b/test/src/models/o_auth2_authentik_test.dart @@ -8,18 +8,20 @@ void main() { $id: 'github', enabled: true, clientId: 'dTKOPa0000000000000000000000000000e7G8hv', - clientSecret: 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + clientSecret: + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', endpoint: 'example.authentik.com', ); final map = model.toMap(); final result = OAuth2Authentik.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'dTKOPa0000000000000000000000000000e7G8hv'); - expect(result.clientSecret, 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK'); - expect(result.endpoint, 'example.authentik.com'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'dTKOPa0000000000000000000000000000e7G8hv'); + expect(result.clientSecret, + 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK'); + expect(result.endpoint, 'example.authentik.com'); + }); }); } diff --git a/test/src/models/o_auth2_autodesk_test.dart b/test/src/models/o_auth2_autodesk_test.dart index 8c540e25..2dfcdc51 100644 --- a/test/src/models/o_auth2_autodesk_test.dart +++ b/test/src/models/o_auth2_autodesk_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Autodesk.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '5zw90v00000000000000000000kVYXN7'); - expect(result.clientSecret, '7I000000000000MW'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '5zw90v00000000000000000000kVYXN7'); + expect(result.clientSecret, '7I000000000000MW'); + }); }); } diff --git a/test/src/models/o_auth2_bitbucket_test.dart b/test/src/models/o_auth2_bitbucket_test.dart index 60165e0e..83900fc3 100644 --- a/test/src/models/o_auth2_bitbucket_test.dart +++ b/test/src/models/o_auth2_bitbucket_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Bitbucket.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.key, 'Knt70000000000ByRc'); - expect(result.secret, 'NMfLZJ00000000000000000000TLQdDx'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.key, 'Knt70000000000ByRc'); + expect(result.secret, 'NMfLZJ00000000000000000000TLQdDx'); + }); }); } diff --git a/test/src/models/o_auth2_bitly_test.dart b/test/src/models/o_auth2_bitly_test.dart index 19095762..581121e8 100644 --- a/test/src/models/o_auth2_bitly_test.dart +++ b/test/src/models/o_auth2_bitly_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Bitly.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'd95151000000000000000000000000000067af9b'); - expect(result.clientSecret, 'a13e250000000000000000000000000000d73095'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'd95151000000000000000000000000000067af9b'); + expect(result.clientSecret, 'a13e250000000000000000000000000000d73095'); + }); }); } diff --git a/test/src/models/o_auth2_box_test.dart b/test/src/models/o_auth2_box_test.dart index 4f7aa2ab..597ce987 100644 --- a/test/src/models/o_auth2_box_test.dart +++ b/test/src/models/o_auth2_box_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Box.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'deglcs00000000000000000000x2og6y'); - expect(result.clientSecret, 'OKM1f100000000000000000000eshEif'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'deglcs00000000000000000000x2og6y'); + expect(result.clientSecret, 'OKM1f100000000000000000000eshEif'); + }); }); } diff --git a/test/src/models/o_auth2_dailymotion_test.dart b/test/src/models/o_auth2_dailymotion_test.dart index 838987a2..1088a137 100644 --- a/test/src/models/o_auth2_dailymotion_test.dart +++ b/test/src/models/o_auth2_dailymotion_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Dailymotion.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.apiKey, '07a9000000000000067f'); - expect(result.apiSecret, 'a399a90000000000000000000000000000d90639'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.apiKey, '07a9000000000000067f'); + expect(result.apiSecret, 'a399a90000000000000000000000000000d90639'); + }); }); } diff --git a/test/src/models/o_auth2_discord_test.dart b/test/src/models/o_auth2_discord_test.dart index c59cbc3a..f0ca8761 100644 --- a/test/src/models/o_auth2_discord_test.dart +++ b/test/src/models/o_auth2_discord_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Discord.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '950722000000343754'); - expect(result.clientSecret, 'YmPXnM000000000000000000002zFg5D'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '950722000000343754'); + expect(result.clientSecret, 'YmPXnM000000000000000000002zFg5D'); + }); }); } diff --git a/test/src/models/o_auth2_disqus_test.dart b/test/src/models/o_auth2_disqus_test.dart index 8d4f62b7..6ac03a4f 100644 --- a/test/src/models/o_auth2_disqus_test.dart +++ b/test/src/models/o_auth2_disqus_test.dart @@ -7,17 +7,21 @@ void main() { final model = OAuth2Disqus( $id: 'github', enabled: true, - publicKey: 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', - secretKey: 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', + publicKey: + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + secretKey: + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9', ); final map = model.toMap(); final result = OAuth2Disqus.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.publicKey, 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX'); - expect(result.secretKey, 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.publicKey, + 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX'); + expect(result.secretKey, + 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9'); + }); }); } diff --git a/test/src/models/o_auth2_dropbox_test.dart b/test/src/models/o_auth2_dropbox_test.dart index e0cf6b69..e97e98e9 100644 --- a/test/src/models/o_auth2_dropbox_test.dart +++ b/test/src/models/o_auth2_dropbox_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Dropbox.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.appKey, 'jl000000000009t'); - expect(result.appSecret, 'g200000000000vw'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.appKey, 'jl000000000009t'); + expect(result.appSecret, 'g200000000000vw'); + }); }); } diff --git a/test/src/models/o_auth2_etsy_test.dart b/test/src/models/o_auth2_etsy_test.dart index 9197710d..2015e584 100644 --- a/test/src/models/o_auth2_etsy_test.dart +++ b/test/src/models/o_auth2_etsy_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Etsy.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.keyString, 'nsgzxh0000000000008j85a2'); - expect(result.sharedSecret, 'tp000000ru'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.keyString, 'nsgzxh0000000000008j85a2'); + expect(result.sharedSecret, 'tp000000ru'); + }); }); } diff --git a/test/src/models/o_auth2_facebook_test.dart b/test/src/models/o_auth2_facebook_test.dart index 960ca133..e8e402c7 100644 --- a/test/src/models/o_auth2_facebook_test.dart +++ b/test/src/models/o_auth2_facebook_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Facebook.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.appId, '260600000007694'); - expect(result.appSecret, '2d0b2800000000000000000000d38af4'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.appId, '260600000007694'); + expect(result.appSecret, '2d0b2800000000000000000000d38af4'); + }); }); } diff --git a/test/src/models/o_auth2_figma_test.dart b/test/src/models/o_auth2_figma_test.dart index f329a826..e44f2265 100644 --- a/test/src/models/o_auth2_figma_test.dart +++ b/test/src/models/o_auth2_figma_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Figma.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'byay5H0000000000VtiI40'); - expect(result.clientSecret, 'yEpOYn0000000000000000004iIsU5'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'byay5H0000000000VtiI40'); + expect(result.clientSecret, 'yEpOYn0000000000000000004iIsU5'); + }); }); } diff --git a/test/src/models/o_auth2_fusion_auth_test.dart b/test/src/models/o_auth2_fusion_auth_test.dart index cf9d2bf0..533fdb8e 100644 --- a/test/src/models/o_auth2_fusion_auth_test.dart +++ b/test/src/models/o_auth2_fusion_auth_test.dart @@ -15,11 +15,12 @@ void main() { final map = model.toMap(); final result = OAuth2FusionAuth.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'b2222c00-0000-0000-0000-000000862097'); - expect(result.clientSecret, 'Jx4s0C0000000000000000000000000000000wGqLsc'); - expect(result.endpoint, 'example.fusionauth.io'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'b2222c00-0000-0000-0000-000000862097'); + expect( + result.clientSecret, 'Jx4s0C0000000000000000000000000000000wGqLsc'); + expect(result.endpoint, 'example.fusionauth.io'); + }); }); } diff --git a/test/src/models/o_auth2_github_test.dart b/test/src/models/o_auth2_github_test.dart index 9ec45b19..2d04ab0d 100644 --- a/test/src/models/o_auth2_github_test.dart +++ b/test/src/models/o_auth2_github_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Github.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'e4d87900000000540733'); - expect(result.clientSecret, '5e07c00000000000000000000000000000198bcc'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'e4d87900000000540733'); + expect(result.clientSecret, '5e07c00000000000000000000000000000198bcc'); + }); }); } diff --git a/test/src/models/o_auth2_gitlab_test.dart b/test/src/models/o_auth2_gitlab_test.dart index 888e7c5c..191516ea 100644 --- a/test/src/models/o_auth2_gitlab_test.dart +++ b/test/src/models/o_auth2_gitlab_test.dart @@ -7,19 +7,23 @@ void main() { final model = OAuth2Gitlab( $id: 'github', enabled: true, - applicationId: 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - secret: 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + applicationId: + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + secret: + 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', endpoint: 'https://gitlab.com', ); final map = model.toMap(); final result = OAuth2Gitlab.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.applicationId, 'd41ffe0000000000000000000000000000000000000000000000000000d5e252'); - expect(result.secret, 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38'); - expect(result.endpoint, 'https://gitlab.com'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.applicationId, + 'd41ffe0000000000000000000000000000000000000000000000000000d5e252'); + expect(result.secret, + 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38'); + expect(result.endpoint, 'https://gitlab.com'); + }); }); } diff --git a/test/src/models/o_auth2_google_test.dart b/test/src/models/o_auth2_google_test.dart index a4c4470f..79ce5d87 100644 --- a/test/src/models/o_auth2_google_test.dart +++ b/test/src/models/o_auth2_google_test.dart @@ -14,10 +14,11 @@ void main() { final map = model.toMap(); final result = OAuth2Google.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'your-google-client-id.apps.googleusercontent.com'); - expect(result.clientSecret, 'your-google-client-secret'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect( + result.clientId, 'your-google-client-id.apps.googleusercontent.com'); + expect(result.clientSecret, 'your-google-client-secret'); + }); }); } diff --git a/test/src/models/o_auth2_keycloak_test.dart b/test/src/models/o_auth2_keycloak_test.dart index bb34bb09..cdef28a8 100644 --- a/test/src/models/o_auth2_keycloak_test.dart +++ b/test/src/models/o_auth2_keycloak_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = OAuth2Keycloak.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'appwrite-o0000000st-app'); - expect(result.clientSecret, 'jdjrJd00000000000000000000HUsaZO'); - expect(result.endpoint, 'keycloak.example.com'); - expect(result.realmName, 'appwrite-realm'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'appwrite-o0000000st-app'); + expect(result.clientSecret, 'jdjrJd00000000000000000000HUsaZO'); + expect(result.endpoint, 'keycloak.example.com'); + expect(result.realmName, 'appwrite-realm'); + }); }); } diff --git a/test/src/models/o_auth2_kick_test.dart b/test/src/models/o_auth2_kick_test.dart index 87103254..e8275cf2 100644 --- a/test/src/models/o_auth2_kick_test.dart +++ b/test/src/models/o_auth2_kick_test.dart @@ -8,16 +8,18 @@ void main() { $id: 'github', enabled: true, clientId: '01KQ7C00000000000001MFHS32', - clientSecret: '34ac5600000000000000000000000000000000000000000000000000e830c8b', + clientSecret: + '34ac5600000000000000000000000000000000000000000000000000e830c8b', ); final map = model.toMap(); final result = OAuth2Kick.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '01KQ7C00000000000001MFHS32'); - expect(result.clientSecret, '34ac5600000000000000000000000000000000000000000000000000e830c8b'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '01KQ7C00000000000001MFHS32'); + expect(result.clientSecret, + '34ac5600000000000000000000000000000000000000000000000000e830c8b'); + }); }); } diff --git a/test/src/models/o_auth2_linkedin_test.dart b/test/src/models/o_auth2_linkedin_test.dart index feb75293..d31c26f9 100644 --- a/test/src/models/o_auth2_linkedin_test.dart +++ b/test/src/models/o_auth2_linkedin_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Linkedin.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '770000000000dv'); - expect(result.primaryClientSecret, 'your-linkedin-client-secret'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '770000000000dv'); + expect(result.primaryClientSecret, 'your-linkedin-client-secret'); + }); }); } diff --git a/test/src/models/o_auth2_microsoft_test.dart b/test/src/models/o_auth2_microsoft_test.dart index e8f534a9..8ae65689 100644 --- a/test/src/models/o_auth2_microsoft_test.dart +++ b/test/src/models/o_auth2_microsoft_test.dart @@ -15,11 +15,11 @@ void main() { final map = model.toMap(); final result = OAuth2Microsoft.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.applicationId, '00001111-aaaa-2222-bbbb-3333cccc4444'); - expect(result.applicationSecret, 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u'); - expect(result.tenant, 'common'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.applicationId, '00001111-aaaa-2222-bbbb-3333cccc4444'); + expect(result.applicationSecret, 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u'); + expect(result.tenant, 'common'); + }); }); } diff --git a/test/src/models/o_auth2_notion_test.dart b/test/src/models/o_auth2_notion_test.dart index 977846a1..7ae50309 100644 --- a/test/src/models/o_auth2_notion_test.dart +++ b/test/src/models/o_auth2_notion_test.dart @@ -14,10 +14,11 @@ void main() { final map = model.toMap(); final result = OAuth2Notion.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.oauthClientId, '341d8700-0000-0000-0000-000000446ee3'); - expect(result.oauthClientSecret, 'secret_dLUr4b000000000000000000000000000000lFHAa9'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.oauthClientId, '341d8700-0000-0000-0000-000000446ee3'); + expect(result.oauthClientSecret, + 'secret_dLUr4b000000000000000000000000000000lFHAa9'); + }); }); } diff --git a/test/src/models/o_auth2_oidc_test.dart b/test/src/models/o_auth2_oidc_test.dart index 005af2f8..99fa9f06 100644 --- a/test/src/models/o_auth2_oidc_test.dart +++ b/test/src/models/o_auth2_oidc_test.dart @@ -8,7 +8,8 @@ void main() { $id: 'github', enabled: true, clientId: 'qibI2x0000000000000000000000000006L2YFoG', - clientSecret: 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + clientSecret: + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', wellKnownURL: 'https://myoauth.com/.well-known/openid-configuration', authorizationURL: 'https://myoauth.com/oauth2/authorize', tokenURL: 'https://myoauth.com/oauth2/token', @@ -18,14 +19,16 @@ void main() { final map = model.toMap(); final result = OAuth2Oidc.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'qibI2x0000000000000000000000000006L2YFoG'); - expect(result.clientSecret, 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV'); - expect(result.wellKnownURL, 'https://myoauth.com/.well-known/openid-configuration'); - expect(result.authorizationURL, 'https://myoauth.com/oauth2/authorize'); - expect(result.tokenURL, 'https://myoauth.com/oauth2/token'); - expect(result.userInfoURL, 'https://myoauth.com/oauth2/userinfo'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'qibI2x0000000000000000000000000006L2YFoG'); + expect(result.clientSecret, + 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV'); + expect(result.wellKnownURL, + 'https://myoauth.com/.well-known/openid-configuration'); + expect(result.authorizationURL, 'https://myoauth.com/oauth2/authorize'); + expect(result.tokenURL, 'https://myoauth.com/oauth2/token'); + expect(result.userInfoURL, 'https://myoauth.com/oauth2/userinfo'); + }); }); } diff --git a/test/src/models/o_auth2_okta_test.dart b/test/src/models/o_auth2_okta_test.dart index b655a138..ca387e81 100644 --- a/test/src/models/o_auth2_okta_test.dart +++ b/test/src/models/o_auth2_okta_test.dart @@ -8,7 +8,8 @@ void main() { $id: 'github', enabled: true, clientId: '0oa00000000000000698', - clientSecret: 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + clientSecret: + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', domain: 'trial-6400025.okta.com', authorizationServerId: 'aus000000000000000h7z', ); @@ -16,12 +17,13 @@ void main() { final map = model.toMap(); final result = OAuth2Okta.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '0oa00000000000000698'); - expect(result.clientSecret, 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV'); - expect(result.domain, 'trial-6400025.okta.com'); - expect(result.authorizationServerId, 'aus000000000000000h7z'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '0oa00000000000000698'); + expect(result.clientSecret, + 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV'); + expect(result.domain, 'trial-6400025.okta.com'); + expect(result.authorizationServerId, 'aus000000000000000h7z'); + }); }); } diff --git a/test/src/models/o_auth2_paypal_test.dart b/test/src/models/o_auth2_paypal_test.dart index 34124a3a..aa77d409 100644 --- a/test/src/models/o_auth2_paypal_test.dart +++ b/test/src/models/o_auth2_paypal_test.dart @@ -7,17 +7,21 @@ void main() { final model = OAuth2Paypal( $id: 'github', enabled: true, - clientId: 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - secretKey: 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', + clientId: + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + secretKey: + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp', ); final map = model.toMap(); final result = OAuth2Paypal.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB'); - expect(result.secretKey, 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, + 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB'); + expect(result.secretKey, + 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp'); + }); }); } diff --git a/test/src/models/o_auth2_podio_test.dart b/test/src/models/o_auth2_podio_test.dart index 974b4426..357cc7f4 100644 --- a/test/src/models/o_auth2_podio_test.dart +++ b/test/src/models/o_auth2_podio_test.dart @@ -8,16 +8,18 @@ void main() { $id: 'github', enabled: true, clientId: 'appwrite-oauth-test-app', - clientSecret: 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', + clientSecret: + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN', ); final map = model.toMap(); final result = OAuth2Podio.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'appwrite-oauth-test-app'); - expect(result.clientSecret, 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'appwrite-oauth-test-app'); + expect(result.clientSecret, + 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN'); + }); }); } diff --git a/test/src/models/o_auth2_provider_list_test.dart b/test/src/models/o_auth2_provider_list_test.dart index 4457a433..36fe2b3c 100644 --- a/test/src/models/o_auth2_provider_list_test.dart +++ b/test/src/models/o_auth2_provider_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = OAuth2ProviderList.fromMap(map); - expect(result.total, 5); - expect(result.providers, []); - }); + expect(result.total, 5); + expect(result.providers, []); + }); }); } diff --git a/test/src/models/o_auth2_salesforce_test.dart b/test/src/models/o_auth2_salesforce_test.dart index 1ebe31ee..b19aa954 100644 --- a/test/src/models/o_auth2_salesforce_test.dart +++ b/test/src/models/o_auth2_salesforce_test.dart @@ -7,17 +7,19 @@ void main() { final model = OAuth2Salesforce( $id: 'github', enabled: true, - customerKey: '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + customerKey: + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', customerSecret: '3w000000000000e2', ); final map = model.toMap(); final result = OAuth2Salesforce.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.customerKey, '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq'); - expect(result.customerSecret, '3w000000000000e2'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.customerKey, + '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq'); + expect(result.customerSecret, '3w000000000000e2'); + }); }); } diff --git a/test/src/models/o_auth2_slack_test.dart b/test/src/models/o_auth2_slack_test.dart index c97e4588..fca5e126 100644 --- a/test/src/models/o_auth2_slack_test.dart +++ b/test/src/models/o_auth2_slack_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Slack.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '23000000089.15000000000023'); - expect(result.clientSecret, '81656000000000000000000000f3d2fd'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '23000000089.15000000000023'); + expect(result.clientSecret, '81656000000000000000000000f3d2fd'); + }); }); } diff --git a/test/src/models/o_auth2_spotify_test.dart b/test/src/models/o_auth2_spotify_test.dart index 98a15fd8..130d47eb 100644 --- a/test/src/models/o_auth2_spotify_test.dart +++ b/test/src/models/o_auth2_spotify_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Spotify.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '6ec271000000000000000000009beace'); - expect(result.clientSecret, 'db068a000000000000000000008b5b9f'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '6ec271000000000000000000009beace'); + expect(result.clientSecret, 'db068a000000000000000000008b5b9f'); + }); }); } diff --git a/test/src/models/o_auth2_stripe_test.dart b/test/src/models/o_auth2_stripe_test.dart index 736ac8ce..fa7316ff 100644 --- a/test/src/models/o_auth2_stripe_test.dart +++ b/test/src/models/o_auth2_stripe_test.dart @@ -8,16 +8,18 @@ void main() { $id: 'github', enabled: true, clientId: 'ca_UKibXX0000000000000000000006byvR', - apiSecretKey: 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', + apiSecretKey: + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp', ); final map = model.toMap(); final result = OAuth2Stripe.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'ca_UKibXX0000000000000000000006byvR'); - expect(result.apiSecretKey, 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'ca_UKibXX0000000000000000000006byvR'); + expect(result.apiSecretKey, + 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp'); + }); }); } diff --git a/test/src/models/o_auth2_tradeshift_test.dart b/test/src/models/o_auth2_tradeshift_test.dart index 4ccfdb80..70d39e15 100644 --- a/test/src/models/o_auth2_tradeshift_test.dart +++ b/test/src/models/o_auth2_tradeshift_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Tradeshift.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.oauth2ClientId, 'appwrite-test-org.appwrite-test-app'); - expect(result.oauth2ClientSecret, '7cb52700-0000-0000-0000-000000ca5b83'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.oauth2ClientId, 'appwrite-test-org.appwrite-test-app'); + expect(result.oauth2ClientSecret, '7cb52700-0000-0000-0000-000000ca5b83'); + }); }); } diff --git a/test/src/models/o_auth2_twitch_test.dart b/test/src/models/o_auth2_twitch_test.dart index b52c26d7..2a75f459 100644 --- a/test/src/models/o_auth2_twitch_test.dart +++ b/test/src/models/o_auth2_twitch_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Twitch.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'vvi0in000000000000000000ikmt9p'); - expect(result.clientSecret, 'pmapue000000000000000000zylw3v'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'vvi0in000000000000000000ikmt9p'); + expect(result.clientSecret, 'pmapue000000000000000000zylw3v'); + }); }); } diff --git a/test/src/models/o_auth2_word_press_test.dart b/test/src/models/o_auth2_word_press_test.dart index c515282c..03ce1976 100644 --- a/test/src/models/o_auth2_word_press_test.dart +++ b/test/src/models/o_auth2_word_press_test.dart @@ -8,16 +8,18 @@ void main() { $id: 'github', enabled: true, clientId: '130005', - clientSecret: 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', + clientSecret: + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk', ); final map = model.toMap(); final result = OAuth2WordPress.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '130005'); - expect(result.clientSecret, 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '130005'); + expect(result.clientSecret, + 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk'); + }); }); } diff --git a/test/src/models/o_auth2_x_test.dart b/test/src/models/o_auth2_x_test.dart index 90d5277d..ba475487 100644 --- a/test/src/models/o_auth2_x_test.dart +++ b/test/src/models/o_auth2_x_test.dart @@ -14,10 +14,11 @@ void main() { final map = model.toMap(); final result = OAuth2X.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.customerKey, 'slzZV0000000000000NFLaWT'); - expect(result.secretKey, 'tkEPkp00000000000000000000000000000000000000FTxbI9'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.customerKey, 'slzZV0000000000000NFLaWT'); + expect(result.secretKey, + 'tkEPkp00000000000000000000000000000000000000FTxbI9'); + }); }); } diff --git a/test/src/models/o_auth2_yahoo_test.dart b/test/src/models/o_auth2_yahoo_test.dart index ef9d4d82..1f845896 100644 --- a/test/src/models/o_auth2_yahoo_test.dart +++ b/test/src/models/o_auth2_yahoo_test.dart @@ -7,17 +7,19 @@ void main() { final model = OAuth2Yahoo( $id: 'github', enabled: true, - clientId: 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + clientId: + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', clientSecret: 'cf978f0000000000000000000000000000c5e2e9', ); final map = model.toMap(); final result = OAuth2Yahoo.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm'); - expect(result.clientSecret, 'cf978f0000000000000000000000000000c5e2e9'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, + 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm'); + expect(result.clientSecret, 'cf978f0000000000000000000000000000c5e2e9'); + }); }); } diff --git a/test/src/models/o_auth2_yandex_test.dart b/test/src/models/o_auth2_yandex_test.dart index ff501508..2e02e5eb 100644 --- a/test/src/models/o_auth2_yandex_test.dart +++ b/test/src/models/o_auth2_yandex_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Yandex.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '6a8a6a0000000000000000000091483c'); - expect(result.clientSecret, 'bbf98500000000000000000000c75a63'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '6a8a6a0000000000000000000091483c'); + expect(result.clientSecret, 'bbf98500000000000000000000c75a63'); + }); }); } diff --git a/test/src/models/o_auth2_zoho_test.dart b/test/src/models/o_auth2_zoho_test.dart index 9ab6d3f8..903f5dcf 100644 --- a/test/src/models/o_auth2_zoho_test.dart +++ b/test/src/models/o_auth2_zoho_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Zoho.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, '1000.83C178000000000000000000RPNX0B'); - expect(result.clientSecret, 'fb5cac000000000000000000000000000000a68f6e'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, '1000.83C178000000000000000000RPNX0B'); + expect(result.clientSecret, 'fb5cac000000000000000000000000000000a68f6e'); + }); }); } diff --git a/test/src/models/o_auth2_zoom_test.dart b/test/src/models/o_auth2_zoom_test.dart index d3a0f43e..22ee92c2 100644 --- a/test/src/models/o_auth2_zoom_test.dart +++ b/test/src/models/o_auth2_zoom_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = OAuth2Zoom.fromMap(map); - expect(result.$id, 'github'); - expect(result.enabled, true); - expect(result.clientId, 'QMAC00000000000000w0AQ'); - expect(result.clientSecret, 'GAWsG4000000000000000000007U01ON'); - }); + expect(result.$id, 'github'); + expect(result.enabled, true); + expect(result.clientId, 'QMAC00000000000000w0AQ'); + expect(result.clientSecret, 'GAWsG4000000000000000000007U01ON'); + }); }); } diff --git a/test/src/models/phone_list_test.dart b/test/src/models/phone_list_test.dart index 63e07b8c..6b5ff57e 100644 --- a/test/src/models/phone_list_test.dart +++ b/test/src/models/phone_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PhoneList.fromMap(map); - expect(result.total, 5); - expect(result.phones, []); - }); + expect(result.total, 5); + expect(result.phones, []); + }); }); } diff --git a/test/src/models/phone_test.dart b/test/src/models/phone_test.dart index e65d3c59..03ba35f6 100644 --- a/test/src/models/phone_test.dart +++ b/test/src/models/phone_test.dart @@ -13,9 +13,9 @@ void main() { final map = model.toMap(); final result = Phone.fromMap(map); - expect(result.code, '+1'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - }); + expect(result.code, '+1'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + }); }); } diff --git a/test/src/models/platform_android_test.dart b/test/src/models/platform_android_test.dart index 1d77a094..67f712fc 100644 --- a/test/src/models/platform_android_test.dart +++ b/test/src/models/platform_android_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformAndroid.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.applicationId, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.applicationId, 'com.company.appname'); + }); }); } diff --git a/test/src/models/platform_apple_test.dart b/test/src/models/platform_apple_test.dart index 88242f44..0c238f4e 100644 --- a/test/src/models/platform_apple_test.dart +++ b/test/src/models/platform_apple_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformApple.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.bundleIdentifier, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.bundleIdentifier, 'com.company.appname'); + }); }); } diff --git a/test/src/models/platform_linux_test.dart b/test/src/models/platform_linux_test.dart index 64273f49..a28a0658 100644 --- a/test/src/models/platform_linux_test.dart +++ b/test/src/models/platform_linux_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformLinux.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.packageName, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.packageName, 'com.company.appname'); + }); }); } diff --git a/test/src/models/platform_list_test.dart b/test/src/models/platform_list_test.dart index 0e3a9188..6661761d 100644 --- a/test/src/models/platform_list_test.dart +++ b/test/src/models/platform_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PlatformList.fromMap(map); - expect(result.total, 5); - expect(result.platforms, []); - }); + expect(result.total, 5); + expect(result.platforms, []); + }); }); } diff --git a/test/src/models/platform_web_test.dart b/test/src/models/platform_web_test.dart index 84673233..29dc32e8 100644 --- a/test/src/models/platform_web_test.dart +++ b/test/src/models/platform_web_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformWeb.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.hostname, 'app.example.com'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.hostname, 'app.example.com'); + }); }); } diff --git a/test/src/models/platform_windows_test.dart b/test/src/models/platform_windows_test.dart index 76808780..57c708f9 100644 --- a/test/src/models/platform_windows_test.dart +++ b/test/src/models/platform_windows_test.dart @@ -17,12 +17,12 @@ void main() { final map = model.toMap(); final result = PlatformWindows.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Web App'); - expect(result.type, PlatformType.windows); - expect(result.packageIdentifierName, 'com.company.appname'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Web App'); + expect(result.type, PlatformType.windows); + expect(result.packageIdentifierName, 'com.company.appname'); + }); }); } diff --git a/test/src/models/policy_list_test.dart b/test/src/models/policy_list_test.dart index ce810910..4f6bb919 100644 --- a/test/src/models/policy_list_test.dart +++ b/test/src/models/policy_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicyList.fromMap(map); - expect(result.total, 9); - expect(result.policies, []); - }); + expect(result.total, 9); + expect(result.policies, []); + }); }); } diff --git a/test/src/models/policy_membership_privacy_test.dart b/test/src/models/policy_membership_privacy_test.dart index bb9b280e..04fa79f0 100644 --- a/test/src/models/policy_membership_privacy_test.dart +++ b/test/src/models/policy_membership_privacy_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = PolicyMembershipPrivacy.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.userId, true); - expect(result.userEmail, true); - expect(result.userPhone, true); - expect(result.userName, true); - expect(result.userMFA, true); - }); + expect(result.$id, 'password-dictionary'); + expect(result.userId, true); + expect(result.userEmail, true); + expect(result.userPhone, true); + expect(result.userName, true); + expect(result.userMFA, true); + }); }); } diff --git a/test/src/models/policy_password_dictionary_test.dart b/test/src/models/policy_password_dictionary_test.dart index 9ecb5c55..458f957f 100644 --- a/test/src/models/policy_password_dictionary_test.dart +++ b/test/src/models/policy_password_dictionary_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicyPasswordDictionary.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.enabled, true); - }); + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/policy_password_history_test.dart b/test/src/models/policy_password_history_test.dart index 56f2a4bc..20acea57 100644 --- a/test/src/models/policy_password_history_test.dart +++ b/test/src/models/policy_password_history_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicyPasswordHistory.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.total, 5); - }); + expect(result.$id, 'password-dictionary'); + expect(result.total, 5); + }); }); } diff --git a/test/src/models/policy_password_personal_data_test.dart b/test/src/models/policy_password_personal_data_test.dart index 767ccd86..ed17b989 100644 --- a/test/src/models/policy_password_personal_data_test.dart +++ b/test/src/models/policy_password_personal_data_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicyPasswordPersonalData.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.enabled, true); - }); + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/policy_session_alert_test.dart b/test/src/models/policy_session_alert_test.dart index 3991797c..f6df96e0 100644 --- a/test/src/models/policy_session_alert_test.dart +++ b/test/src/models/policy_session_alert_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicySessionAlert.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.enabled, true); - }); + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/policy_session_duration_test.dart b/test/src/models/policy_session_duration_test.dart index 2b0628ce..e1b17439 100644 --- a/test/src/models/policy_session_duration_test.dart +++ b/test/src/models/policy_session_duration_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicySessionDuration.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.duration, 3600); - }); + expect(result.$id, 'password-dictionary'); + expect(result.duration, 3600); + }); }); } diff --git a/test/src/models/policy_session_invalidation_test.dart b/test/src/models/policy_session_invalidation_test.dart index d0fb3bfc..a879957f 100644 --- a/test/src/models/policy_session_invalidation_test.dart +++ b/test/src/models/policy_session_invalidation_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicySessionInvalidation.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.enabled, true); - }); + expect(result.$id, 'password-dictionary'); + expect(result.enabled, true); + }); }); } diff --git a/test/src/models/policy_session_limit_test.dart b/test/src/models/policy_session_limit_test.dart index 5a4d7786..40a8d0f6 100644 --- a/test/src/models/policy_session_limit_test.dart +++ b/test/src/models/policy_session_limit_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicySessionLimit.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.total, 10); - }); + expect(result.$id, 'password-dictionary'); + expect(result.total, 10); + }); }); } diff --git a/test/src/models/policy_user_limit_test.dart b/test/src/models/policy_user_limit_test.dart index 93ace965..3c86fa0f 100644 --- a/test/src/models/policy_user_limit_test.dart +++ b/test/src/models/policy_user_limit_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PolicyUserLimit.fromMap(map); - expect(result.$id, 'password-dictionary'); - expect(result.total, 100); - }); + expect(result.$id, 'password-dictionary'); + expect(result.total, 100); + }); }); } diff --git a/test/src/models/preferences_test.dart b/test/src/models/preferences_test.dart index 7f0e6ba0..8711977f 100644 --- a/test/src/models/preferences_test.dart +++ b/test/src/models/preferences_test.dart @@ -10,7 +10,6 @@ void main() { final map = model.toMap(); final result = Preferences.fromMap(map); - }); }); } diff --git a/test/src/models/presence_list_test.dart b/test/src/models/presence_list_test.dart index c88aba0b..9b661f46 100644 --- a/test/src/models/presence_list_test.dart +++ b/test/src/models/presence_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = PresenceList.fromMap(map); - expect(result.total, 5); - expect(result.presences, []); - }); + expect(result.total, 5); + expect(result.presences, []); + }); }); } diff --git a/test/src/models/presence_test.dart b/test/src/models/presence_test.dart index 1cffd434..dc9a8b9c 100644 --- a/test/src/models/presence_test.dart +++ b/test/src/models/presence_test.dart @@ -19,14 +19,14 @@ void main() { final map = model.toMap(); final result = Presence.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$sequence, '1'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.userInternalId, '1'); - expect(result.userId, '674af8f3e12a5f9ac0be'); - expect(result.source, 'HTTP'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.userInternalId, '1'); + expect(result.userId, '674af8f3e12a5f9ac0be'); + expect(result.source, 'HTTP'); + }); }); } diff --git a/test/src/models/project_test.dart b/test/src/models/project_test.dart index 02886f07..82981e67 100644 --- a/test/src/models/project_test.dart +++ b/test/src/models/project_test.dart @@ -84,15 +84,15 @@ void main() { protocolStatusForWebsocket: true, region: 'fra', billingLimits: BillingLimits( - bandwidth: 5, - storage: 150, - users: 200000, - executions: 750000, - GBHours: 100, - imageTransformations: 100, - authPhone: 10, - budgetLimit: 100, - ), + bandwidth: 5, + storage: 150, + users: 200000, + executions: 750000, + GBHours: 100, + imageTransformations: 100, + authPhone: 10, + budgetLimit: 100, + ), blocks: [], consoleAccessedAt: '2020-10-15T06:38:00.000+00:00', ); @@ -100,86 +100,86 @@ void main() { final map = model.toMap(); final result = Project.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'New Project'); - expect(result.description, 'This is a new project.'); - expect(result.teamId, '1592981250'); - expect(result.logo, '5f5c451b403cb'); - expect(result.url, '5f5c451b403cb'); - expect(result.legalName, 'Company LTD.'); - expect(result.legalCountry, 'US'); - expect(result.legalState, 'New York'); - expect(result.legalCity, 'New York City.'); - expect(result.legalAddress, '620 Eighth Avenue, New York, NY 10018'); - expect(result.legalTaxId, '131102020'); - expect(result.authDuration, 60); - expect(result.authLimit, 100); - expect(result.authSessionsLimit, 10); - expect(result.authPasswordHistory, 5); - expect(result.authPasswordDictionary, true); - expect(result.authPersonalDataCheck, true); - expect(result.authDisposableEmails, true); - expect(result.authCanonicalEmails, true); - expect(result.authFreeEmails, true); - expect(result.authMockNumbers, []); - expect(result.authSessionAlerts, true); - expect(result.authMembershipsUserName, true); - expect(result.authMembershipsUserEmail, true); - expect(result.authMembershipsMfa, true); - expect(result.authMembershipsUserId, true); - expect(result.authMembershipsUserPhone, true); - expect(result.authInvalidateSessions, true); - expect(result.oAuthProviders, []); - expect(result.platforms, []); - expect(result.webhooks, []); - expect(result.keys, []); - expect(result.devKeys, []); - expect(result.smtpEnabled, true); - expect(result.smtpSenderName, 'John Appwrite'); - expect(result.smtpSenderEmail, 'john@appwrite.io'); - expect(result.smtpReplyToName, 'Support Team'); - expect(result.smtpReplyToEmail, 'support@appwrite.io'); - expect(result.smtpHost, 'mail.appwrite.io'); - expect(result.smtpPort, 25); - expect(result.smtpUsername, 'emailuser'); - expect(result.smtpPassword, ''); - expect(result.smtpSecure, 'tls'); - expect(result.pingCount, 1); - expect(result.pingedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.labels, []); - expect(result.status, 'active'); - expect(result.authEmailPassword, true); - expect(result.authUsersAuthMagicURL, true); - expect(result.authEmailOtp, true); - expect(result.authAnonymous, true); - expect(result.authInvites, true); - expect(result.authJWT, true); - expect(result.authPhone, true); - expect(result.serviceStatusForAccount, true); - expect(result.serviceStatusForAvatars, true); - expect(result.serviceStatusForDatabases, true); - expect(result.serviceStatusForTablesdb, true); - expect(result.serviceStatusForLocale, true); - expect(result.serviceStatusForHealth, true); - expect(result.serviceStatusForProject, true); - expect(result.serviceStatusForStorage, true); - expect(result.serviceStatusForTeams, true); - expect(result.serviceStatusForUsers, true); - expect(result.serviceStatusForVcs, true); - expect(result.serviceStatusForSites, true); - expect(result.serviceStatusForFunctions, true); - expect(result.serviceStatusForProxy, true); - expect(result.serviceStatusForGraphql, true); - expect(result.serviceStatusForMigrations, true); - expect(result.serviceStatusForMessaging, true); - expect(result.protocolStatusForRest, true); - expect(result.protocolStatusForGraphql, true); - expect(result.protocolStatusForWebsocket, true); - expect(result.region, 'fra'); - expect(result.blocks, []); - expect(result.consoleAccessedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'New Project'); + expect(result.description, 'This is a new project.'); + expect(result.teamId, '1592981250'); + expect(result.logo, '5f5c451b403cb'); + expect(result.url, '5f5c451b403cb'); + expect(result.legalName, 'Company LTD.'); + expect(result.legalCountry, 'US'); + expect(result.legalState, 'New York'); + expect(result.legalCity, 'New York City.'); + expect(result.legalAddress, '620 Eighth Avenue, New York, NY 10018'); + expect(result.legalTaxId, '131102020'); + expect(result.authDuration, 60); + expect(result.authLimit, 100); + expect(result.authSessionsLimit, 10); + expect(result.authPasswordHistory, 5); + expect(result.authPasswordDictionary, true); + expect(result.authPersonalDataCheck, true); + expect(result.authDisposableEmails, true); + expect(result.authCanonicalEmails, true); + expect(result.authFreeEmails, true); + expect(result.authMockNumbers, []); + expect(result.authSessionAlerts, true); + expect(result.authMembershipsUserName, true); + expect(result.authMembershipsUserEmail, true); + expect(result.authMembershipsMfa, true); + expect(result.authMembershipsUserId, true); + expect(result.authMembershipsUserPhone, true); + expect(result.authInvalidateSessions, true); + expect(result.oAuthProviders, []); + expect(result.platforms, []); + expect(result.webhooks, []); + expect(result.keys, []); + expect(result.devKeys, []); + expect(result.smtpEnabled, true); + expect(result.smtpSenderName, 'John Appwrite'); + expect(result.smtpSenderEmail, 'john@appwrite.io'); + expect(result.smtpReplyToName, 'Support Team'); + expect(result.smtpReplyToEmail, 'support@appwrite.io'); + expect(result.smtpHost, 'mail.appwrite.io'); + expect(result.smtpPort, 25); + expect(result.smtpUsername, 'emailuser'); + expect(result.smtpPassword, ''); + expect(result.smtpSecure, 'tls'); + expect(result.pingCount, 1); + expect(result.pingedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.labels, []); + expect(result.status, 'active'); + expect(result.authEmailPassword, true); + expect(result.authUsersAuthMagicURL, true); + expect(result.authEmailOtp, true); + expect(result.authAnonymous, true); + expect(result.authInvites, true); + expect(result.authJWT, true); + expect(result.authPhone, true); + expect(result.serviceStatusForAccount, true); + expect(result.serviceStatusForAvatars, true); + expect(result.serviceStatusForDatabases, true); + expect(result.serviceStatusForTablesdb, true); + expect(result.serviceStatusForLocale, true); + expect(result.serviceStatusForHealth, true); + expect(result.serviceStatusForProject, true); + expect(result.serviceStatusForStorage, true); + expect(result.serviceStatusForTeams, true); + expect(result.serviceStatusForUsers, true); + expect(result.serviceStatusForVcs, true); + expect(result.serviceStatusForSites, true); + expect(result.serviceStatusForFunctions, true); + expect(result.serviceStatusForProxy, true); + expect(result.serviceStatusForGraphql, true); + expect(result.serviceStatusForMigrations, true); + expect(result.serviceStatusForMessaging, true); + expect(result.protocolStatusForRest, true); + expect(result.protocolStatusForGraphql, true); + expect(result.protocolStatusForWebsocket, true); + expect(result.region, 'fra'); + expect(result.blocks, []); + expect(result.consoleAccessedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/provider_list_test.dart b/test/src/models/provider_list_test.dart index 22860b71..8100c9dc 100644 --- a/test/src/models/provider_list_test.dart +++ b/test/src/models/provider_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ProviderList.fromMap(map); - expect(result.total, 5); - expect(result.providers, []); - }); + expect(result.total, 5); + expect(result.providers, []); + }); }); } diff --git a/test/src/models/provider_test.dart b/test/src/models/provider_test.dart index e1e5a13f..d3b1a8ab 100644 --- a/test/src/models/provider_test.dart +++ b/test/src/models/provider_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Provider.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'Mailgun'); - expect(result.provider, 'mailgun'); - expect(result.enabled, true); - expect(result.type, 'sms'); - expect(result.credentials, {}); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'Mailgun'); + expect(result.provider, 'mailgun'); + expect(result.enabled, true); + expect(result.type, 'sms'); + expect(result.credentials, {}); + }); }); } diff --git a/test/src/models/proxy_rule_list_test.dart b/test/src/models/proxy_rule_list_test.dart index a6d17472..ceff1f64 100644 --- a/test/src/models/proxy_rule_list_test.dart +++ b/test/src/models/proxy_rule_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ProxyRuleList.fromMap(map); - expect(result.total, 5); - expect(result.rules, []); - }); + expect(result.total, 5); + expect(result.rules, []); + }); }); } diff --git a/test/src/models/proxy_rule_test.dart b/test/src/models/proxy_rule_test.dart index da848191..d7fff4ec 100644 --- a/test/src/models/proxy_rule_test.dart +++ b/test/src/models/proxy_rule_test.dart @@ -18,27 +18,29 @@ void main() { deploymentResourceId: 'n3u9feiwmf', deploymentVcsProviderBranch: 'main', status: ProxyRuleStatus.unverified, - logs: 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + logs: + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', renewAt: 'datetime', ); final map = model.toMap(); final result = ProxyRule.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.domain, 'appwrite.company.com'); - expect(result.type, 'deployment'); - expect(result.trigger, 'manual'); - expect(result.redirectUrl, 'https://appwrite.io/docs'); - expect(result.redirectStatusCode, 301); - expect(result.deploymentId, 'n3u9feiwmf'); - expect(result.deploymentResourceId, 'n3u9feiwmf'); - expect(result.deploymentVcsProviderBranch, 'main'); - expect(result.status, ProxyRuleStatus.unverified); - expect(result.logs, 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.'); - expect(result.renewAt, 'datetime'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.domain, 'appwrite.company.com'); + expect(result.type, 'deployment'); + expect(result.trigger, 'manual'); + expect(result.redirectUrl, 'https://appwrite.io/docs'); + expect(result.redirectStatusCode, 301); + expect(result.deploymentId, 'n3u9feiwmf'); + expect(result.deploymentResourceId, 'n3u9feiwmf'); + expect(result.deploymentVcsProviderBranch, 'main'); + expect(result.status, ProxyRuleStatus.unverified); + expect(result.logs, + 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.'); + expect(result.renewAt, 'datetime'); + }); }); } diff --git a/test/src/models/resource_token_list_test.dart b/test/src/models/resource_token_list_test.dart index f087996a..1cda3569 100644 --- a/test/src/models/resource_token_list_test.dart +++ b/test/src/models/resource_token_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = ResourceTokenList.fromMap(map); - expect(result.total, 5); - expect(result.tokens, []); - }); + expect(result.total, 5); + expect(result.tokens, []); + }); }); } diff --git a/test/src/models/resource_token_test.dart b/test/src/models/resource_token_test.dart index e8f7bd34..bb6dfbc0 100644 --- a/test/src/models/resource_token_test.dart +++ b/test/src/models/resource_token_test.dart @@ -10,20 +10,22 @@ void main() { resourceId: '5e5ea5c168bb8:5e5ea5c168bb8', resourceType: 'files', expire: '2020-10-15T06:38:00.000+00:00', - secret: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + secret: + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', accessedAt: '2020-10-15T06:38:00.000+00:00', ); final map = model.toMap(); final result = ResourceToken.fromMap(map); - expect(result.$id, 'bb8ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.resourceId, '5e5ea5c168bb8:5e5ea5c168bb8'); - expect(result.resourceType, 'files'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.secret, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, 'bb8ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.resourceId, '5e5ea5c168bb8:5e5ea5c168bb8'); + expect(result.resourceType, 'files'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.secret, + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/row_list_test.dart b/test/src/models/row_list_test.dart index b803a52f..ce334d8b 100644 --- a/test/src/models/row_list_test.dart +++ b/test/src/models/row_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = RowList.fromMap(map); - expect(result.total, 5); - expect(result.rows, []); - }); + expect(result.total, 5); + expect(result.rows, []); + }); }); } diff --git a/test/src/models/row_test.dart b/test/src/models/row_test.dart index bc1860b6..5d81c348 100644 --- a/test/src/models/row_test.dart +++ b/test/src/models/row_test.dart @@ -18,13 +18,13 @@ void main() { final map = model.toMap(); final result = Row.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$sequence, '1'); - expect(result.$tableId, '5e5ea5c15117e'); - expect(result.$databaseId, '5e5ea5c15117e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$sequence, '1'); + expect(result.$tableId, '5e5ea5c15117e'); + expect(result.$databaseId, '5e5ea5c15117e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + }); }); } diff --git a/test/src/models/runtime_list_test.dart b/test/src/models/runtime_list_test.dart index 020b8f17..59f6f94d 100644 --- a/test/src/models/runtime_list_test.dart +++ b/test/src/models/runtime_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = RuntimeList.fromMap(map); - expect(result.total, 5); - expect(result.runtimes, []); - }); + expect(result.total, 5); + expect(result.runtimes, []); + }); }); } diff --git a/test/src/models/runtime_test.dart b/test/src/models/runtime_test.dart index c2a070dd..225c368b 100644 --- a/test/src/models/runtime_test.dart +++ b/test/src/models/runtime_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Runtime.fromMap(map); - expect(result.$id, 'python-3.8'); - expect(result.key, 'python'); - expect(result.name, 'Python'); - expect(result.version, '3.8'); - expect(result.base, 'python:3.8-alpine'); - expect(result.image, 'appwrite\\/runtime-for-python:3.8'); - expect(result.logo, 'python.png'); - expect(result.supports, []); - }); + expect(result.$id, 'python-3.8'); + expect(result.key, 'python'); + expect(result.name, 'Python'); + expect(result.version, '3.8'); + expect(result.base, 'python:3.8-alpine'); + expect(result.image, 'appwrite\\/runtime-for-python:3.8'); + expect(result.logo, 'python.png'); + expect(result.supports, []); + }); }); } diff --git a/test/src/models/session_list_test.dart b/test/src/models/session_list_test.dart index 5d675fd9..b7bc83cc 100644 --- a/test/src/models/session_list_test.dart +++ b/test/src/models/session_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SessionList.fromMap(map); - expect(result.total, 5); - expect(result.sessions, []); - }); + expect(result.total, 5); + expect(result.sessions, []); + }); }); } diff --git a/test/src/models/session_test.dart b/test/src/models/session_test.dart index a52c9cf0..adda7c0d 100644 --- a/test/src/models/session_test.dart +++ b/test/src/models/session_test.dart @@ -39,35 +39,35 @@ void main() { final map = model.toMap(); final result = Session.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5bb8c16897e'); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.provider, 'email'); - expect(result.providerUid, 'user@example.com'); - expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); - expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); - expect(result.ip, '127.0.0.1'); - expect(result.osCode, 'Mac'); - expect(result.osName, 'Mac'); - expect(result.osVersion, 'Mac'); - expect(result.clientType, 'browser'); - expect(result.clientCode, 'CM'); - expect(result.clientName, 'Chrome Mobile iOS'); - expect(result.clientVersion, '84.0'); - expect(result.clientEngine, 'WebKit'); - expect(result.clientEngineVersion, '605.1.15'); - expect(result.deviceName, 'smartphone'); - expect(result.deviceBrand, 'Google'); - expect(result.deviceModel, 'Nexus 5'); - expect(result.countryCode, 'US'); - expect(result.countryName, 'United States'); - expect(result.current, true); - expect(result.factors, []); - expect(result.secret, '5e5bb8c16897e'); - expect(result.mfaUpdatedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5bb8c16897e'); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.provider, 'email'); + expect(result.providerUid, 'user@example.com'); + expect(result.providerAccessToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + expect(result.providerAccessTokenExpiry, '2020-10-15T06:38:00.000+00:00'); + expect(result.providerRefreshToken, 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3'); + expect(result.ip, '127.0.0.1'); + expect(result.osCode, 'Mac'); + expect(result.osName, 'Mac'); + expect(result.osVersion, 'Mac'); + expect(result.clientType, 'browser'); + expect(result.clientCode, 'CM'); + expect(result.clientName, 'Chrome Mobile iOS'); + expect(result.clientVersion, '84.0'); + expect(result.clientEngine, 'WebKit'); + expect(result.clientEngineVersion, '605.1.15'); + expect(result.deviceName, 'smartphone'); + expect(result.deviceBrand, 'Google'); + expect(result.deviceModel, 'Nexus 5'); + expect(result.countryCode, 'US'); + expect(result.countryName, 'United States'); + expect(result.current, true); + expect(result.factors, []); + expect(result.secret, '5e5bb8c16897e'); + expect(result.mfaUpdatedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/site_list_test.dart b/test/src/models/site_list_test.dart index 288619b8..4bfbbcb8 100644 --- a/test/src/models/site_list_test.dart +++ b/test/src/models/site_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SiteList.fromMap(map); - expect(result.total, 5); - expect(result.sites, []); - }); + expect(result.total, 5); + expect(result.sites, []); + }); }); } diff --git a/test/src/models/site_test.dart b/test/src/models/site_test.dart index 7000c91b..6d97b6f2 100644 --- a/test/src/models/site_test.dart +++ b/test/src/models/site_test.dart @@ -42,38 +42,38 @@ void main() { final map = model.toMap(); final result = Site.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Site'); - expect(result.enabled, true); - expect(result.live, true); - expect(result.logging, true); - expect(result.framework, 'react'); - expect(result.deploymentRetention, 7); - expect(result.deploymentId, '5e5ea5c16897e'); - expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.deploymentScreenshotLight, '5e5ea5c16897e'); - expect(result.deploymentScreenshotDark, '5e5ea5c16897e'); - expect(result.latestDeploymentId, '5e5ea5c16897e'); - expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.latestDeploymentStatus, 'ready'); - expect(result.vars, []); - expect(result.timeout, 300); - expect(result.installCommand, 'npm install'); - expect(result.buildCommand, 'npm run build'); - expect(result.startCommand, 'node custom-server.mjs'); - expect(result.outputDirectory, 'build'); - expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); - expect(result.providerRepositoryId, 'appwrite'); - expect(result.providerBranch, 'main'); - expect(result.providerRootDirectory, 'sites/helloWorld'); - expect(result.providerSilentMode, true); - expect(result.buildSpecification, 's-1vcpu-512mb'); - expect(result.runtimeSpecification, 's-1vcpu-512mb'); - expect(result.buildRuntime, 'node-22'); - expect(result.adapter, 'static'); - expect(result.fallbackFile, 'index.html'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Site'); + expect(result.enabled, true); + expect(result.live, true); + expect(result.logging, true); + expect(result.framework, 'react'); + expect(result.deploymentRetention, 7); + expect(result.deploymentId, '5e5ea5c16897e'); + expect(result.deploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.deploymentScreenshotLight, '5e5ea5c16897e'); + expect(result.deploymentScreenshotDark, '5e5ea5c16897e'); + expect(result.latestDeploymentId, '5e5ea5c16897e'); + expect(result.latestDeploymentCreatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.latestDeploymentStatus, 'ready'); + expect(result.vars, []); + expect(result.timeout, 300); + expect(result.installCommand, 'npm install'); + expect(result.buildCommand, 'npm run build'); + expect(result.startCommand, 'node custom-server.mjs'); + expect(result.outputDirectory, 'build'); + expect(result.installationId, '6m40at4ejk5h2u9s1hboo'); + expect(result.providerRepositoryId, 'appwrite'); + expect(result.providerBranch, 'main'); + expect(result.providerRootDirectory, 'sites/helloWorld'); + expect(result.providerSilentMode, true); + expect(result.buildSpecification, 's-1vcpu-512mb'); + expect(result.runtimeSpecification, 's-1vcpu-512mb'); + expect(result.buildRuntime, 'node-22'); + expect(result.adapter, 'static'); + expect(result.fallbackFile, 'index.html'); + }); }); } diff --git a/test/src/models/specification_list_test.dart b/test/src/models/specification_list_test.dart index 7e2f821d..569f8cab 100644 --- a/test/src/models/specification_list_test.dart +++ b/test/src/models/specification_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SpecificationList.fromMap(map); - expect(result.total, 5); - expect(result.specifications, []); - }); + expect(result.total, 5); + expect(result.specifications, []); + }); }); } diff --git a/test/src/models/specification_test.dart b/test/src/models/specification_test.dart index b61ff9e4..a174559f 100644 --- a/test/src/models/specification_test.dart +++ b/test/src/models/specification_test.dart @@ -14,10 +14,10 @@ void main() { final map = model.toMap(); final result = Specification.fromMap(map); - expect(result.memory, 512); - expect(result.cpus, 1); - expect(result.enabled, true); - expect(result.slug, 's-1vcpu-512mb'); - }); + expect(result.memory, 512); + expect(result.cpus, 1); + expect(result.enabled, true); + expect(result.slug, 's-1vcpu-512mb'); + }); }); } diff --git a/test/src/models/subscriber_list_test.dart b/test/src/models/subscriber_list_test.dart index 401a785e..2ef39800 100644 --- a/test/src/models/subscriber_list_test.dart +++ b/test/src/models/subscriber_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = SubscriberList.fromMap(map); - expect(result.total, 5); - expect(result.subscribers, []); - }); + expect(result.total, 5); + expect(result.subscribers, []); + }); }); } diff --git a/test/src/models/subscriber_test.dart b/test/src/models/subscriber_test.dart index 32d1f9e1..ee6ac198 100644 --- a/test/src/models/subscriber_test.dart +++ b/test/src/models/subscriber_test.dart @@ -10,15 +10,15 @@ void main() { $updatedAt: '2020-10-15T06:38:00.000+00:00', targetId: '259125845563242502', target: Target( - $id: '259125845563242502', - $createdAt: '2020-10-15T06:38:00.000+00:00', - $updatedAt: '2020-10-15T06:38:00.000+00:00', - name: 'Apple iPhone 12', - userId: '259125845563242502', - providerType: 'email', - identifier: 'token', - expired: true, - ), + $id: '259125845563242502', + $createdAt: '2020-10-15T06:38:00.000+00:00', + $updatedAt: '2020-10-15T06:38:00.000+00:00', + name: 'Apple iPhone 12', + userId: '259125845563242502', + providerType: 'email', + identifier: 'token', + expired: true, + ), userId: '5e5ea5c16897e', userName: 'Aegon Targaryen', topicId: '259125845563242502', @@ -28,14 +28,14 @@ void main() { final map = model.toMap(); final result = Subscriber.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.targetId, '259125845563242502'); - expect(result.userId, '5e5ea5c16897e'); - expect(result.userName, 'Aegon Targaryen'); - expect(result.topicId, '259125845563242502'); - expect(result.providerType, 'email'); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.targetId, '259125845563242502'); + expect(result.userId, '5e5ea5c16897e'); + expect(result.userName, 'Aegon Targaryen'); + expect(result.topicId, '259125845563242502'); + expect(result.providerType, 'email'); + }); }); } diff --git a/test/src/models/table_list_test.dart b/test/src/models/table_list_test.dart index f06d5fc6..1330ab89 100644 --- a/test/src/models/table_list_test.dart +++ b/test/src/models/table_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TableList.fromMap(map); - expect(result.total, 5); - expect(result.tables, []); - }); + expect(result.total, 5); + expect(result.tables, []); + }); }); } diff --git a/test/src/models/table_test.dart b/test/src/models/table_test.dart index f6b94ecf..0919800d 100644 --- a/test/src/models/table_test.dart +++ b/test/src/models/table_test.dart @@ -22,18 +22,18 @@ void main() { final map = model.toMap(); final result = Table.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$permissions, []); - expect(result.databaseId, '5e5ea5c16897e'); - expect(result.name, 'My Table'); - expect(result.enabled, true); - expect(result.rowSecurity, true); - expect(result.columns, []); - expect(result.indexes, []); - expect(result.bytesMax, 65535); - expect(result.bytesUsed, 1500); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$permissions, []); + expect(result.databaseId, '5e5ea5c16897e'); + expect(result.name, 'My Table'); + expect(result.enabled, true); + expect(result.rowSecurity, true); + expect(result.columns, []); + expect(result.indexes, []); + expect(result.bytesMax, 65535); + expect(result.bytesUsed, 1500); + }); }); } diff --git a/test/src/models/target_list_test.dart b/test/src/models/target_list_test.dart index 0db975ff..7920cc85 100644 --- a/test/src/models/target_list_test.dart +++ b/test/src/models/target_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TargetList.fromMap(map); - expect(result.total, 5); - expect(result.targets, []); - }); + expect(result.total, 5); + expect(result.targets, []); + }); }); } diff --git a/test/src/models/target_test.dart b/test/src/models/target_test.dart index 6f864758..655a840c 100644 --- a/test/src/models/target_test.dart +++ b/test/src/models/target_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Target.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'Apple iPhone 12'); - expect(result.userId, '259125845563242502'); - expect(result.providerType, 'email'); - expect(result.identifier, 'token'); - expect(result.expired, true); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'Apple iPhone 12'); + expect(result.userId, '259125845563242502'); + expect(result.providerType, 'email'); + expect(result.identifier, 'token'); + expect(result.expired, true); + }); }); } diff --git a/test/src/models/team_list_test.dart b/test/src/models/team_list_test.dart index f358a3c9..875bd1af 100644 --- a/test/src/models/team_list_test.dart +++ b/test/src/models/team_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TeamList.fromMap(map); - expect(result.total, 5); - expect(result.teams, []); - }); + expect(result.total, 5); + expect(result.teams, []); + }); }); } diff --git a/test/src/models/team_test.dart b/test/src/models/team_test.dart index 6285fe54..59eb9701 100644 --- a/test/src/models/team_test.dart +++ b/test/src/models/team_test.dart @@ -16,11 +16,11 @@ void main() { final map = model.toMap(); final result = Team.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'VIP'); - expect(result.total, 7); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'VIP'); + expect(result.total, 7); + }); }); } diff --git a/test/src/models/token_test.dart b/test/src/models/token_test.dart index 01cb97ff..90ae6415 100644 --- a/test/src/models/token_test.dart +++ b/test/src/models/token_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = Token.fromMap(map); - expect(result.$id, 'bb8ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.userId, '5e5ea5c168bb8'); - expect(result.secret, ''); - expect(result.expire, '2020-10-15T06:38:00.000+00:00'); - expect(result.phrase, 'Golden Fox'); - }); + expect(result.$id, 'bb8ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.userId, '5e5ea5c168bb8'); + expect(result.secret, ''); + expect(result.expire, '2020-10-15T06:38:00.000+00:00'); + expect(result.phrase, 'Golden Fox'); + }); }); } diff --git a/test/src/models/topic_list_test.dart b/test/src/models/topic_list_test.dart index 617e46d3..bae2557b 100644 --- a/test/src/models/topic_list_test.dart +++ b/test/src/models/topic_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TopicList.fromMap(map); - expect(result.total, 5); - expect(result.topics, []); - }); + expect(result.total, 5); + expect(result.topics, []); + }); }); } diff --git a/test/src/models/topic_test.dart b/test/src/models/topic_test.dart index 1c244535..b5cf9bdd 100644 --- a/test/src/models/topic_test.dart +++ b/test/src/models/topic_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Topic.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'events'); - expect(result.emailTotal, 100); - expect(result.smsTotal, 100); - expect(result.pushTotal, 100); - expect(result.subscribe, []); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'events'); + expect(result.emailTotal, 100); + expect(result.smsTotal, 100); + expect(result.pushTotal, 100); + expect(result.subscribe, []); + }); }); } diff --git a/test/src/models/transaction_list_test.dart b/test/src/models/transaction_list_test.dart index 85e19be2..09c2b67a 100644 --- a/test/src/models/transaction_list_test.dart +++ b/test/src/models/transaction_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = TransactionList.fromMap(map); - expect(result.total, 5); - expect(result.transactions, []); - }); + expect(result.total, 5); + expect(result.transactions, []); + }); }); } diff --git a/test/src/models/transaction_test.dart b/test/src/models/transaction_test.dart index 3892d0dc..cd5f953f 100644 --- a/test/src/models/transaction_test.dart +++ b/test/src/models/transaction_test.dart @@ -16,12 +16,12 @@ void main() { final map = model.toMap(); final result = Transaction.fromMap(map); - expect(result.$id, '259125845563242502'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.status, 'pending'); - expect(result.operations, 5); - expect(result.expiresAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '259125845563242502'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.status, 'pending'); + expect(result.operations, 5); + expect(result.expiresAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/user_list_test.dart b/test/src/models/user_list_test.dart index 61b350b8..3503253d 100644 --- a/test/src/models/user_list_test.dart +++ b/test/src/models/user_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = UserList.fromMap(map); - expect(result.total, 5); - expect(result.users, []); - }); + expect(result.total, 5); + expect(result.users, []); + }); }); } diff --git a/test/src/models/user_test.dart b/test/src/models/user_test.dart index 47e85f4b..f1283199 100644 --- a/test/src/models/user_test.dart +++ b/test/src/models/user_test.dart @@ -26,21 +26,21 @@ void main() { final map = model.toMap(); final result = User.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'John Doe'); - expect(result.registration, '2020-10-15T06:38:00.000+00:00'); - expect(result.status, true); - expect(result.labels, []); - expect(result.passwordUpdate, '2020-10-15T06:38:00.000+00:00'); - expect(result.email, 'john@appwrite.io'); - expect(result.phone, '+4930901820'); - expect(result.emailVerification, true); - expect(result.phoneVerification, true); - expect(result.mfa, true); - expect(result.targets, []); - expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'John Doe'); + expect(result.registration, '2020-10-15T06:38:00.000+00:00'); + expect(result.status, true); + expect(result.labels, []); + expect(result.passwordUpdate, '2020-10-15T06:38:00.000+00:00'); + expect(result.email, 'john@appwrite.io'); + expect(result.phone, '+4930901820'); + expect(result.emailVerification, true); + expect(result.phoneVerification, true); + expect(result.mfa, true); + expect(result.targets, []); + expect(result.accessedAt, '2020-10-15T06:38:00.000+00:00'); + }); }); } diff --git a/test/src/models/variable_list_test.dart b/test/src/models/variable_list_test.dart index 1ed9a0d3..b9de10b3 100644 --- a/test/src/models/variable_list_test.dart +++ b/test/src/models/variable_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = VariableList.fromMap(map); - expect(result.total, 5); - expect(result.variables, []); - }); + expect(result.total, 5); + expect(result.variables, []); + }); }); } diff --git a/test/src/models/variable_test.dart b/test/src/models/variable_test.dart index 5e2d0344..322de49b 100644 --- a/test/src/models/variable_test.dart +++ b/test/src/models/variable_test.dart @@ -18,14 +18,14 @@ void main() { final map = model.toMap(); final result = Variable.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.key, 'API_KEY'); - expect(result.value, 'myPa\$\$word1'); - expect(result.secret, true); - expect(result.resourceType, 'function'); - expect(result.resourceId, 'myAwesomeFunction'); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.key, 'API_KEY'); + expect(result.value, 'myPa\$\$word1'); + expect(result.secret, true); + expect(result.resourceType, 'function'); + expect(result.resourceId, 'myAwesomeFunction'); + }); }); } diff --git a/test/src/models/webhook_list_test.dart b/test/src/models/webhook_list_test.dart index 0c5fb86e..c17b9143 100644 --- a/test/src/models/webhook_list_test.dart +++ b/test/src/models/webhook_list_test.dart @@ -12,8 +12,8 @@ void main() { final map = model.toMap(); final result = WebhookList.fromMap(map); - expect(result.total, 5); - expect(result.webhooks, []); - }); + expect(result.total, 5); + expect(result.webhooks, []); + }); }); } diff --git a/test/src/models/webhook_test.dart b/test/src/models/webhook_test.dart index c7a6bbb9..fd64e1db 100644 --- a/test/src/models/webhook_test.dart +++ b/test/src/models/webhook_test.dart @@ -23,19 +23,19 @@ void main() { final map = model.toMap(); final result = Webhook.fromMap(map); - expect(result.$id, '5e5ea5c16897e'); - expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); - expect(result.name, 'My Webhook'); - expect(result.url, 'https://example.com/webhook'); - expect(result.events, []); - expect(result.tls, true); - expect(result.authUsername, 'username'); - expect(result.authPassword, 'password'); - expect(result.secret, 'ad3d581ca230e2b7059c545e5a'); - expect(result.enabled, true); - expect(result.logs, 'Failed to connect to remote server.'); - expect(result.attempts, 10); - }); + expect(result.$id, '5e5ea5c16897e'); + expect(result.$createdAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.$updatedAt, '2020-10-15T06:38:00.000+00:00'); + expect(result.name, 'My Webhook'); + expect(result.url, 'https://example.com/webhook'); + expect(result.events, []); + expect(result.tls, true); + expect(result.authUsername, 'username'); + expect(result.authPassword, 'password'); + expect(result.secret, 'ad3d581ca230e2b7059c545e5a'); + expect(result.enabled, true); + expect(result.logs, 'Failed to connect to remote server.'); + expect(result.attempts, 10); + }); }); }